From 4e92a16d8d24f13afa0938b97c5ee9fd68c7e50c Mon Sep 17 00:00:00 2001 From: vcoppe Date: Fri, 23 May 2025 09:12:02 +0200 Subject: [PATCH] fix zip creation when multiple files have the same name --- website/src/lib/stores.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/src/lib/stores.ts b/website/src/lib/stores.ts index c808aa42..739aff42 100644 --- a/website/src/lib/stores.ts +++ b/website/src/lib/stores.ts @@ -451,7 +451,11 @@ async function exportFilesAsZip(fileIds: string[], exclude: string[]) { const file = getFile(fileId); if (file) { const gpx = buildGPX(file, exclude); - zip.file(file.metadata.name + '.gpx', gpx); + let filename = file.metadata.name; + for (let i = 1; zip.files[filename + '.gpx']; i++) { + filename = file.metadata.name + `-${i}`; + } + zip.file(filename + '.gpx', gpx); } } if (Object.keys(zip.files).length > 0) {