Skip to content

Commit c1851fa

Browse files
(WIP) xpath (fix): support trailing semicolon in encoded geotrace/geoshape value
WIP because there are scenario test updates pending. Commiting incomplete to have something to push before team meeting!
1 parent 8954cf0 commit c1851fa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/xpath/src/lib/geo/Geotrace.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ const collectLines = (geopoints: GeotracePoints): readonly GeotraceLine[] => {
3939

4040
export class Geotrace {
4141
static fromEncodedGeotrace(encoded: string): Geotrace {
42-
const geopoints = encoded.split(/\s*;\s*/).map((value) => {
43-
return Geopoint.fromNodeValue(value);
44-
});
42+
const geopoints = encoded
43+
.replace(/\s*;\s*$/, '')
44+
.split(/\s*;\s*/)
45+
.map((value) => {
46+
return Geopoint.fromNodeValue(value);
47+
});
4548

4649
return this.fromGeopoints(geopoints);
4750
}

0 commit comments

Comments
 (0)