From dd4521324cad38ebb0ab894e0d084d1a5faa1500 Mon Sep 17 00:00:00 2001 From: GMrrc <143954951+GMrrc@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:04:40 +0100 Subject: [PATCH] fix transfert --- src/components/FileTable.vue | 32 ++++++++++++++--------------- src/components/WebContentViewer.vue | 5 +---- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/components/FileTable.vue b/src/components/FileTable.vue index 1f27fe9..f886795 100644 --- a/src/components/FileTable.vue +++ b/src/components/FileTable.vue @@ -407,25 +407,24 @@ export default { try { this.isTransfering = true; const file = this.file; + if (!file) return; if (file.isList) { await this.moveListOfFiles(file); - return; - } - - if (!file) return; - if (file.isDirectory) { - await this.moveFilesOfFolder(file, ''); } else { - this.transferProgress = 25; - if (file.content && typeof file.content.arrayBuffer === 'function') { - file.content = await file.content.arrayBuffer(); + if (file.isDirectory) { + await this.moveFilesOfFolder(file, ''); + } else { + this.transferProgress = 25; + if (file.content && typeof file.content.arrayBuffer === 'function') { + file.content = await file.content.arrayBuffer(); + } + this.transferProgress = 50; + await this.moveFileToTarget(file, ''); + this.transferProgress = 100; } - this.transferProgress = 50; - await this.moveFileToTarget(file, ''); - this.transferProgress = 100; } - + this.isTransfering = false; this.transferProgress = 0; this.cancelOperation = false; @@ -443,14 +442,15 @@ export default { this.isDroppable = true; }, async moveListOfFiles(files) { - for (const file of files) { + for (const file of files.children) { if (file.isDirectory) { - await this.moveFilesOfFolder(file, ''); + //just create the folder + await this.createFolder(file, file.parentPath + '/'); } else { if (file.content && typeof file.content.arrayBuffer === 'function') { file.content = await file.content.arrayBuffer(); } - await this.moveFileToTarget(file, ''); + await this.moveFileToTarget(file, file.parentPath + '/'); } } }, diff --git a/src/components/WebContentViewer.vue b/src/components/WebContentViewer.vue index d84b996..11db017 100644 --- a/src/components/WebContentViewer.vue +++ b/src/components/WebContentViewer.vue @@ -72,7 +72,6 @@ {{ formatFileSize(file.size) }} -
@@ -333,9 +332,7 @@ export default { unzip: Promise.all(this.cochedFiles.map(file => file.unzip)) }; try { - const files = getFilesFromFolder(folder); - const filesToUnzip = files.map(file => file.unzip); - await Promise.all(filesToUnzip); + await folder.unzip; this.$emit('file-upload', folder); } catch (error) { console.error('Erreur lors du drag start :', error);