Skip to content

Commit

Permalink
fix: decodeURI for path params and splat
Browse files Browse the repository at this point in the history
Fixes #1012
  • Loading branch information
tannerlinsley committed Jan 26, 2024
1 parent 743eaf1 commit a201903
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/react-router/src/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ export function matchByPath(
if (routeSegment) {
if (routeSegment.type === 'wildcard') {
if (baseSegment?.value) {
const _splat = joinPaths(baseSegments.slice(i).map((d) => d.value))
const _splat = decodeURI(
joinPaths(baseSegments.slice(i).map((d) => d.value)),
)
// TODO: Deprecate *
params['*'] = _splat
params['_splat'] = _splat
Expand Down Expand Up @@ -257,7 +259,9 @@ export function matchByPath(
return false
}
if (baseSegment.value.charAt(0) !== '$') {
params[routeSegment.value.substring(1)] = baseSegment.value
params[routeSegment.value.substring(1)] = decodeURI(
baseSegment.value,
)
}
}
}
Expand Down

0 comments on commit a201903

Please sign in to comment.