Skip to content

Commit

Permalink
Permalink: enforce constraints on permalink format
Browse files Browse the repository at this point in the history
  • Loading branch information
nboisteault committed Dec 6, 2023
1 parent c78580d commit de47bea
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions assets/src/modules/Permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default class Permalink {
this._ignoreHashChange = false;
return;
}
this._runPermalink()
if (window.location.hash) {
this._runPermalink();
}
}
);

Expand Down Expand Up @@ -128,9 +130,14 @@ export default class Permalink {

_runPermalink(setExtent = true) {
const items = mainLizmap.state.layersAndGroupsCollection.layers.concat(mainLizmap.state.layersAndGroupsCollection.groups);

if (window.location.hash === "") {
return;
}

const [extent4326, itemsInURL, stylesInURL, opacitiesInURL] = window.location.hash.substring(1).split('|').map(part => part.split(','));

if (setExtent) {
if (setExtent && extent4326.length === 4) {
const mapExtent = transformExtent(
extent4326.map(coord => parseFloat(coord)),
'EPSG:4326',
Expand Down

0 comments on commit de47bea

Please sign in to comment.