From 9b7e6ddc69c550bd0833c90c876303f8d27d299a Mon Sep 17 00:00:00 2001
From: Benedikt Heinrichs <heinrichs@itc.rwth-aachen.de>
Date: Wed, 15 May 2024 10:59:16 +0200
Subject: [PATCH] Fix: Allow same file selection after removal from list

---
 src/modules/resource/pages/ResourcePage.vue | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/modules/resource/pages/ResourcePage.vue b/src/modules/resource/pages/ResourcePage.vue
index b6414db5..7eafa33b 100644
--- a/src/modules/resource/pages/ResourcePage.vue
+++ b/src/modules/resource/pages/ResourcePage.vue
@@ -421,13 +421,26 @@ export default defineComponent({
           lastModified: `${file.lastModified}`,
           metadata: { [version]: factory.dataset() as unknown as Dataset },
         };
-        this.fileListUpload.push(fileInformation);
+
+        // Prevent duplicates
+        if (
+          !this.fileListUpload.some(
+            (entry) => entry.path === fileInformation.path,
+          )
+        ) {
+          this.fileListUpload.push(fileInformation);
+        }
       }
 
       // Clear selection in files view table
       (
         (this.$refs.filesView as Vue).$refs.adaptTable as BTable
       ).clearSelected();
+
+      // Clear form-file inputs
+      (this.$refs.fileTrigger as BFormFile).reset();
+      (this.$refs.folderTrigger as BFormFile).reset();
+
       this.showDetail = false;
     },
 
-- 
GitLab