Skip to content

Commit 1c0f5ca

Browse files
committed
Updated as per comments
1 parent c56923a commit 1c0f5ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Router/utils/router.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { step, navigateQueue } from '../index'
3131
import { createRoute, getOption } from './route'
3232
import { createComponent } from './components'
3333
import Log from '../../Log'
34-
import { isWildcard } from './regex'
34+
import { isWildcard, stripRegex } from './regex'
3535
import emit from './emit'
3636
import { updateWidgets } from './widgets'
3737
import { setHistory, updateHistory } from './history'
@@ -263,11 +263,11 @@ const init = config => {
263263
}
264264
}
265265
config.routes.forEach(item => {
266-
let path = item.path
266+
const path = stripRegex(item.path)
267267
// Pattern to identify the last path of the route
268268
// It should start with "/:" + any word and ends with "?"
269269
// Example /player/:asset/:assetId?
270-
const pattern = /\/:{1}\w+\?$/
270+
const pattern = /.*\/:.*?\?$/u
271271
if (pattern.test(item.path)) {
272272
const optionalPath = path.substring(0, path.lastIndexOf('/'))
273273
const originalPath = path.substring(0, path.lastIndexOf('?'))

0 commit comments

Comments
 (0)