mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 15:43:25 +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,
|
||||
attributeNamePrefix: "",
|
||||
attributesGroupName: 'attributes',
|
||||
isArray: (name: string) => {
|
||||
isArray(name: string) {
|
||||
return name === 'trk' || name === 'trkseg' || name === 'trkpt' || name === 'wpt' || name === 'rte' || name === 'rtept' || name === 'gpxx:rpt';
|
||||
},
|
||||
attributeValueProcessor(attrName, attrValue, jPath) {
|
||||
@@ -52,6 +52,11 @@ export function parseGPX(gpxData: string): GPXFile {
|
||||
|
||||
const parsed: GPXFileType = parser.parse(gpxData).gpx;
|
||||
|
||||
// @ts-ignore
|
||||
if (parsed.metadata === "") {
|
||||
parsed.metadata = {};
|
||||
}
|
||||
|
||||
return new GPXFile(parsed);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user