Skip to content

Commit

Permalink
Merge pull request #1076 from geoadmin/pb-742-malformed-link
Browse files Browse the repository at this point in the history
PB-742: Do not decodeURI twice.
  • Loading branch information
ismailsunni authored Sep 30, 2024
2 parents 5f4ebf5 + 8619923 commit 693e590
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/router/legacyPermalinkManagement.routerPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const handleLegacyParam = (
) => {
const { projection } = store.state.position
let newValue

let key = param
switch (param) {
case 'zoom':
Expand Down Expand Up @@ -158,9 +157,10 @@ const handleLegacyParam = (
// When receiving a query, the application will encode the URI components
// We decode those so that the new query won't encode encoded character
// for example, we avoid having " " becoming %2520 in the URI
newQuery[key] = decodeURIComponent(newValue)
// But we don't decode the value if it's a layer, as it's already encoded in transformLayerIntoUrlString function
newQuery[key] = param == 'layers' ? newValue : decodeURIComponent(newValue)
log.info(
`[Legacy URL] ${param}=${legacyValue} parameter changed to ${key}=${decodeURIComponent(newValue)}`,
`[Legacy URL] ${param}=${legacyValue} parameter changed to ${key}=${newQuery[key]}`,
newQuery
)
} else {
Expand Down

0 comments on commit 693e590

Please sign in to comment.