From d1d7b23da6cc0c9a2f2f3e17021ec4f13ea557dd Mon Sep 17 00:00:00 2001 From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com> Date: Mon, 2 May 2022 15:03:02 +0000 Subject: [PATCH] fix: folder info on upload list --- frontend/src/components/prompts/UploadFiles.vue | 1 + frontend/src/store/getters.js | 8 +++++--- frontend/src/utils/upload.js | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/prompts/UploadFiles.vue b/frontend/src/components/prompts/UploadFiles.vue index cad8bc0f..37ea3a36 100644 --- a/frontend/src/components/prompts/UploadFiles.vue +++ b/frontend/src/components/prompts/UploadFiles.vue @@ -25,6 +25,7 @@ class="file" v-for="file in filesInUpload" :key="file.id" + :data-dir="file.isDir" :data-type="file.type" :aria-label="file.name" > diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js index eee94fe2..ce0598a5 100644 --- a/frontend/src/store/getters.js +++ b/frontend/src/store/getters.js @@ -25,15 +25,17 @@ const getters = { let upload = state.upload.uploads[index]; let id = upload.id; let type = upload.type; - let name = decodeURIComponent(upload.path.replace(/^.*[\\/]/, "")); - let progress = state.upload.progress[id]; + let name = upload.file.name; let size = state.upload.sizes[id]; + let isDir = upload.file.isDir; + let progress = isDir ? 100 : Math.ceil((state.upload.progress[id] / size) * 100); files.push({ id, name, - progress: Math.ceil((progress / size) * 100), + progress, type, + isDir, }); } diff --git a/frontend/src/utils/upload.js b/frontend/src/utils/upload.js index 3e3690e4..05cf5ea6 100644 --- a/frontend/src/utils/upload.js +++ b/frontend/src/utils/upload.js @@ -70,6 +70,7 @@ export function scanFiles(dt) { isDir: true, size: 0, fullPath: `${directory}${entry.name}`, + name: entry.name, }; contents.push(dir);