mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(nuxt): escape colons in page paths (#21731)
This commit is contained in:
parent
c72bc95473
commit
1cd48cbef9
@ -104,7 +104,7 @@ function getRoutePath (tokens: SegmentToken[]): string {
|
||||
? `:${token.value}()`
|
||||
: token.type === SegmentTokenType.catchall
|
||||
? `:${token.value}(.*)*`
|
||||
: encodePath(token.value))
|
||||
: encodePath(token.value).replace(/:/g, '\\:'))
|
||||
)
|
||||
}, '/')
|
||||
}
|
||||
|
@ -279,6 +279,20 @@ describe('pages:generateRoutesFromFiles', () => {
|
||||
children: []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
description: 'should allow pages with `:` in their path',
|
||||
files: [
|
||||
`${pagesDir}/test:name.vue`
|
||||
],
|
||||
output: [
|
||||
{
|
||||
name: 'test:name',
|
||||
path: '/test\\:name',
|
||||
file: `${pagesDir}/test:name.vue`,
|
||||
children: []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user