From 617cca8dea133e11638f356a8d111ec82fc7c609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20G=C3=B6bel?= <dgoebel@techfak.uni-bielefeld.de> Date: Fri, 13 Dec 2024 15:31:58 +0000 Subject: [PATCH] Set correct range header when downloading mutiple files #176 --- .../object-storage/modals/DownloadObjectsModal.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/object-storage/modals/DownloadObjectsModal.vue b/src/components/object-storage/modals/DownloadObjectsModal.vue index 8cac3a1..70e499a 100644 --- a/src/components/object-storage/modals/DownloadObjectsModal.vue +++ b/src/components/object-storage/modals/DownloadObjectsModal.vue @@ -125,6 +125,7 @@ async function downloadInChunks( let rangeAndLength: RangeLength = { start: -1, end: -1, length: -1 }; downloadState.fileSize = 0; downloadState.downloadedBytes = 0; + await objectRepository.fetchS3ObjectMeta(bucket, key); while (!isComplete(rangeAndLength)) { const nextRange: Range = { start: rangeAndLength.end + 1, @@ -138,10 +139,15 @@ async function downloadInChunks( ); } try { + const metaKey = bucket + "/" + key; const response = await getObjectRange( bucket, key, - nextRange, + objectRepository.objectMetaMapping[metaKey]?.ContentLength != + undefined && + objectRepository.objectMetaMapping[metaKey]?.ContentLength < PART_SIZE + ? undefined + : nextRange, abortController, ); if (response.Body != undefined) { @@ -394,7 +400,7 @@ const enableDownload = typeof window.showDirectoryPicker === "function"; :disabled="!enableDownload" @click="downloadFiles()" > - Save + Download </button> <button v-else -- GitLab