Skip to content

Commit 6e960c2

Browse files
xpath(fix): ignore any number of trailing semicolons in serialized geopoint list
1 parent 48cb3c9 commit 6e960c2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ const collectLines = (geopoints: GeotracePoints): readonly GeotraceLine[] => {
3939
export class Geotrace {
4040
static fromEncodedGeotrace(encoded: string): Geotrace | null {
4141
const geopoints = encoded
42-
.replace(/\s*;\s*$/, '')
42+
.trim()
43+
// Consistency with JavaRosa: any number of trailing semicolons are
44+
// ignored, with any amount of whitespace between them.
45+
.replace(/(\s*;)+$/, '')
4346
.split(/\s*;\s*/)
4447
.map((value) => {
4548
return geopointCodec.decodeValue(value);

0 commit comments

Comments
 (0)