mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-30 06:50:36 +02:00
fix(v2): properly dedupe forward slashes in the entire URL path (#2405)
This commit is contained in:
parent
6562a06944
commit
ed5a994c7e
2 changed files with 6 additions and 2 deletions
|
@ -253,8 +253,8 @@ export function normalizeUrl(rawUrls: string[]): string {
|
|||
const parts = str.split('?');
|
||||
str = parts.shift() + (parts.length > 0 ? '?' : '') + parts.join('&');
|
||||
|
||||
// Dedupe forward slashes.
|
||||
str = str.replace(/^\/+/, '/');
|
||||
// Dedupe forward slashes in the entire path, avoiding protocol slashes.
|
||||
str = str.replace(/([^:]\/)\/+/g, '$1');
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue