mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-03 17:12:31 +00:00
fix empty metadata tag value parsed as empty string
This commit is contained in:
@@ -7,7 +7,7 @@ export function parseGPX(gpxData: string): GPXFile {
|
|||||||
ignoreAttributes: false,
|
ignoreAttributes: false,
|
||||||
attributeNamePrefix: "",
|
attributeNamePrefix: "",
|
||||||
attributesGroupName: 'attributes',
|
attributesGroupName: 'attributes',
|
||||||
isArray: (name: string) => {
|
isArray(name: string) {
|
||||||
return name === 'trk' || name === 'trkseg' || name === 'trkpt' || name === 'wpt' || name === 'rte' || name === 'rtept' || name === 'gpxx:rpt';
|
return name === 'trk' || name === 'trkseg' || name === 'trkpt' || name === 'wpt' || name === 'rte' || name === 'rtept' || name === 'gpxx:rpt';
|
||||||
},
|
},
|
||||||
attributeValueProcessor(attrName, attrValue, jPath) {
|
attributeValueProcessor(attrName, attrValue, jPath) {
|
||||||
@@ -52,6 +52,11 @@ export function parseGPX(gpxData: string): GPXFile {
|
|||||||
|
|
||||||
const parsed: GPXFileType = parser.parse(gpxData).gpx;
|
const parsed: GPXFileType = parser.parse(gpxData).gpx;
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
if (parsed.metadata === "") {
|
||||||
|
parsed.metadata = {};
|
||||||
|
}
|
||||||
|
|
||||||
return new GPXFile(parsed);
|
return new GPXFile(parsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user