From bb80b3ee546af92006de9f3cba1e62d2bc903b9e Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Mon, 13 Nov 2023 01:38:22 -0800 Subject: [PATCH] Clear file upload input to allow re-uploading the same item. --- frontend/src/components/UploadButton.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/UploadButton.vue b/frontend/src/components/UploadButton.vue index 21e881c..32d7ea0 100644 --- a/frontend/src/components/UploadButton.vue +++ b/frontend/src/components/UploadButton.vue @@ -19,9 +19,10 @@ type CloudFile = { function uploadHandler(event: Event) { event.preventDefault() - event.stopPropagation() // @ts-ignore - const infiles = Array.from(event.dataTransfer?.files || event.target.files) as File[] + const input = event.target as HTMLInputElement | null + const infiles = Array.from((input ?? (event as DragEvent).dataTransfer)?.files ?? []) as File[] + if (input) input.value = '' if (!infiles.length) return const loc = props.path!.join('/') let files = []