mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-27 10:37:17 +00:00
fix zip creation when multiple files have the same name
This commit is contained in:
1 parent
b4bcda12c2
commit
4e92a16d8d
1 file changed
+5
-1
@@ -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