mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 15:43:25 +00:00
fix zip creation when multiple files have the same name
This commit is contained in:
@@ -451,7 +451,11 @@ async function exportFilesAsZip(fileIds: string[], exclude: string[]) {
|
|||||||
const file = getFile(fileId);
|
const file = getFile(fileId);
|
||||||
if (file) {
|
if (file) {
|
||||||
const gpx = buildGPX(file, exclude);
|
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) {
|
if (Object.keys(zip.files).length > 0) {
|
||||||
|
Reference in New Issue
Block a user