mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-25 20:48:50 +02:00
fix(utils): remove non-ASCII limitation for path normalization (#8137)
This commit is contained in:
parent
efbd0cbd40
commit
6c8af03f51
4 changed files with 4 additions and 7 deletions
|
@ -58,12 +58,7 @@ export function shortName(str: string): string {
|
|||
export function posixPath(str: string): string {
|
||||
const isExtendedLengthPath = str.startsWith('\\\\?\\');
|
||||
|
||||
// Forward slashes are only valid Windows paths when they don't contain non-
|
||||
// ascii characters.
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const hasNonAscii = /[^\u0000-\u0080]+/.test(str);
|
||||
|
||||
if (isExtendedLengthPath || hasNonAscii) {
|
||||
if (isExtendedLengthPath) {
|
||||
return str;
|
||||
}
|
||||
return str.replace(/\\/g, '/');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue