Tab name: also fallback to filename when metadata "name" tag exists but is empty (#92)
This commit is contained in:
parent
7adf660b76
commit
5236fc5191
1 changed files with 4 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue