mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-30 23:30:04 +00:00
Tab name: also fallback to filename when metadata "name" tag exists but is empty (#92)
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user