mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 23:57:22 +02:00
fix(v2): unbreak blog-only mode routing by deplicating starting forward slashes (#2497)
This commit is contained in:
parent
d1326cdee8
commit
da7fd1a186
2 changed files with 7 additions and 0 deletions
|
@ -254,6 +254,10 @@ describe('load utils', () => {
|
|||
input: ['/test/', '/', 'ro', 'doc1'],
|
||||
output: '/test/ro/doc1',
|
||||
},
|
||||
{
|
||||
input: ['/', '/', '2020/02/29/leap-day'],
|
||||
output: '/2020/02/29/leap-day',
|
||||
},
|
||||
{
|
||||
input: ['', '/', 'ko', 'hello'],
|
||||
output: '/ko/hello',
|
||||
|
|
|
@ -256,6 +256,9 @@ export function normalizeUrl(rawUrls: string[]): string {
|
|||
// Dedupe forward slashes in the entire path, avoiding protocol slashes.
|
||||
str = str.replace(/([^:]\/)\/+/g, '$1');
|
||||
|
||||
// Dedupe forward slashes at the beginning of the path.
|
||||
str = str.replace(/^\/+/g, '/');
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue