-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
I would like to hear your thoughts how to solve a problem with percent encoded characters in an URL. The following example illustrates what I'm trying to get working:
const RouteNode = require('route-node')
const rootNode = new RouteNode('', '', [{
name: 'product-page',
path: '/:productName<.+>/:productId<(\\w{2}[0-9]{4})>.html'
}])
const matchedPath = rootNode.matchPath('/something-%21-%23-%24-%25-/B41680.html')
console.log('matchedPath', matchedPath)
rootNode.matchPath returns null because segment has an encoded value and consumedPath has the same value but it is decoded (it is decoded in path-parser). See the code here: https://github.com/troch/route-node/blob/master/modules/matchChildren.ts#L64
Do you think I should just do decodeURIComponent(segment)?
Metadata
Metadata
Assignees
Labels
No labels