Tab name: also fallback to filename when metadata "name" tag exists but is empty (#92)

This commit is contained in:
Pierre Donias
2024-09-13 13:59:25 +02:00
committed by GitHub
parent 7adf660b76
commit 5236fc5191

View File

@@ -269,9 +269,10 @@ export async function loadFile(file: File): Promise<GPXFile | null> {
if (data) {
let gpx = parseGPX(data);
if (gpx.metadata === undefined) {
gpx.metadata = { name: file.name.split('.').slice(0, -1).join('.') };
} else if (gpx.metadata.name === undefined) {
gpx.metadata['name'] = file.name.split('.').slice(0, -1).join('.');
gpx.metadata = {};
}
if (gpx.metadata.name === undefined || gpx.metadata.name.trim() === '') {
gpx.metadata.name = file.name.split('.').slice(0, -1).join('.');
}
resolve(gpx);
} else {