Skip to content

Commit

Permalink
fix(matcher): should try catch decode only
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Oct 15, 2020
1 parent 4b926e3 commit 1f32f03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/create-matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,16 @@ function matchRoute (
path: string,
params: Object
): boolean {
let m
try {
m = decodeURI(path).match(regex)
path = decodeURI(path)
} catch (err) {
if (process.env.NODE_ENV !== 'production') {
warn(false, `Error decoding "${path}". Leaving it intact.`)
}
}
const m = path.match(regex)
if (!m) {
return false
} else if (!params) {
Expand Down

0 comments on commit 1f32f03

Please sign in to comment.