Skip to content

Commit ff0d385

Browse files
[bugfix] Fix double-click required after pasting URL in upload model dialog (#6801)
## Summary Fixed an issue where users had to click twice to continue after pasting a URL in the upload model dialog - once to blur the input, then again to click the button. ## Changes - **What**: Replaced `UrlInput` with plain `InputText` in `UploadModelUrlInput` to emit value immediately on input instead of only on blur - **Cleanup**: Moved URL cleaning/normalization to the `fetchMetadata` handler, removed unused `disableValidation` prop from `UrlInput` component ## Review Focus - URL normalization logic in `useUploadModelWizard.ts` 🤖 Generated with [Claude Code](https://claude.com/claude-code) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6801-bugfix-Fix-double-click-required-after-pasting-URL-in-upload-model-dialog-2b26d73d3650811881aed0cc064efcc7) by [Unito](https://www.unito.io) --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6e2e591 commit ff0d385

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/components/common/UrlInput.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import { ValidationState } from '@/utils/validationUtil'
3535
const props = defineProps<{
3636
modelValue: string
3737
validateUrlFn?: (url: string) => Promise<boolean>
38-
disableValidation?: boolean
3938
}>()
4039
4140
const emit = defineEmits<{
@@ -102,8 +101,6 @@ const defaultValidateUrl = async (url: string): Promise<boolean> => {
102101
}
103102
104103
const validateUrl = async (value: string) => {
105-
if (props.disableValidation) return
106-
107104
if (validationState.value === ValidationState.LOADING) return
108105
109106
const url = cleanInput(value)

src/platform/assets/components/UploadModelUrlInput.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
<label class="text-sm text-muted mb-0">
1515
{{ $t('assetBrowser.civitaiLinkLabel') }}
1616
</label>
17-
<UrlInput
17+
<InputText
1818
v-model="url"
1919
:placeholder="$t('assetBrowser.civitaiLinkPlaceholder')"
20-
:disable-validation="true"
20+
class="w-full"
2121
/>
2222
<p v-if="error" class="text-xs text-error">
2323
{{ error }}
@@ -30,10 +30,9 @@
3030
</template>
3131

3232
<script setup lang="ts">
33+
import InputText from 'primevue/inputtext'
3334
import { computed } from 'vue'
3435
35-
import UrlInput from '@/components/common/UrlInput.vue'
36-
3736
const props = defineProps<{
3837
modelValue: string
3938
error?: string

src/platform/assets/composables/useUploadModelWizard.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ export function useUploadModelWizard(modelTypes: Ref<ModelTypeOption[]>) {
6262
async function fetchMetadata() {
6363
if (!canFetchMetadata.value) return
6464

65+
// Clean and normalize URL
66+
let cleanedUrl = wizardData.value.url.trim()
67+
try {
68+
cleanedUrl = new URL(encodeURI(cleanedUrl)).toString()
69+
} catch {
70+
// If URL parsing fails, just use the trimmed input
71+
}
72+
wizardData.value.url = cleanedUrl
73+
6574
if (!isCivitaiUrl(wizardData.value.url)) {
6675
uploadError.value = st(
6776
'assetBrowser.onlyCivitaiUrlsSupported',

0 commit comments

Comments
 (0)