fix: allocate share-link layer tokens without collisions

This commit is contained in:
manjunath22466 committed 2026-09-24 16:25:55 +05:30
1 parent ce671ce500
commit 54735a9e6f
15 files changed
+1295 -20

No files matched your search

+17
View File
@@ -78,6 +78,23 @@ test('unknown-only v2 layer tokens are invalid, while historical l fields stay i
}
});
test('malformed v2 layer lists mark the whole incoming share payload invalid', () => {
for (const layers of ['.f', 'f.', 'f..c', 'f.f']) {
const parsed = makeManager(
`#v=2&lat=10&lon=20&l=${layers}`,
).parseInitialHash();
assert.equal(parsed.layerState, null, `l=${layers}`);
assert.equal(parsed.layerStateInvalid, true, `l=${layers}`);
}
for (const layers of ['l=f&l=f', 'l=f&l=unknown', 'l=&l=f']) {
const parsed = makeManager(
`#v=2&lat=10&lon=20&${layers}`,
).parseInitialHash();
assert.equal(parsed.layerState, null, layers);
assert.equal(parsed.layerStateInvalid, true, layers);
}
});
test('Nepal locator token is valid in v2 share links', () => {
const parsed = makeManager('#v=2&lat=10&lon=20&l=z').parseInitialHash();
assert.deepEqual(parsed.layerState.enabledLayerIds, ['bhote-koshi-locator']);