mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-06 21:03:47 +02:00
fix(v2): doc path special char (space or other) should lead to a valid slug (#3262)
* doc path special char (space or other) should lead to a valid slug * doc path special char (space or other) should lead to a valid slug * improve doc bad slug message
This commit is contained in:
parent
b75a7150b2
commit
dd3f3f1093
4 changed files with 21 additions and 3 deletions
|
@ -365,7 +365,8 @@ export function isValidPathname(str: string): boolean {
|
|||
}
|
||||
try {
|
||||
// weird, but is there a better way?
|
||||
return new URL(str, 'https://domain.com').pathname === str;
|
||||
const parsedPathname = new URL(str, 'https://domain.com').pathname;
|
||||
return parsedPathname === str || parsedPathname === encodeURI(str);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue