From a45eed2fbb67e1e0a9c925fc6d9b651afe9f5e2b Mon Sep 17 00:00:00 2001 From: keven1024 Date: Sun, 20 Apr 2025 21:13:32 +0800 Subject: [PATCH] fix(front): update FileUpload component to allow all file types and improve type checking for accepted file formats --- front/components/FileUpload.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/front/components/FileUpload.vue b/front/components/FileUpload.vue index e779f32..0b296e9 100644 --- a/front/components/FileUpload.vue +++ b/front/components/FileUpload.vue @@ -6,7 +6,7 @@ const props = defineProps<{ accept?: string[] }>() -const accept = computed(() => (props?.accept || ['image/*', 'video/*'])?.join(',')) +const accept = computed(() => (props?.accept || ['*'])?.join(',')) const emit = defineEmits<{ (e: 'onChange', file: File): void @@ -24,6 +24,9 @@ const { isOverDropZone } = useDropZone(dropZoneRef, { for (const acceptType of accept.value.split(',')) { if (acceptType?.endsWith('*')) { const [acceptTypePrefix,] = acceptType?.split('/') + if (!acceptTypePrefix) { + return true + } if (type?.startsWith(acceptTypePrefix)) { return true }