fix zip creation when multiple files have the same name

This commit is contained in:
vcoppe
2025-05-23 09:12:02 +02:00
parent b4bcda12c2
commit 4e92a16d8d

View File

@@ -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) {