diff --git a/packages/docusaurus-utils/src/__tests__/pathUtils.test.ts b/packages/docusaurus-utils/src/__tests__/pathUtils.test.ts index 6059d2946d08..3927b09a7a0a 100644 --- a/packages/docusaurus-utils/src/__tests__/pathUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/pathUtils.test.ts @@ -156,7 +156,7 @@ describe('posixPath', () => { it('works', () => { const asserts: {[key: string]: string} = { 'c:/aaaa\\bbbb': 'c:/aaaa/bbbb', - 'c:\\aaaa\\bbbb\\★': 'c:\\aaaa\\bbbb\\★', + 'c:\\aaaa\\bbbb\\★': 'c:/aaaa/bbbb/★', '\\\\?\\c:\\aaaa\\bbbb': '\\\\?\\c:\\aaaa\\bbbb', 'c:\\aaaa\\bbbb': 'c:/aaaa/bbbb', 'foo\\bar': 'foo/bar', diff --git a/packages/docusaurus-utils/src/pathUtils.ts b/packages/docusaurus-utils/src/pathUtils.ts index 35b8bd2656e8..f68d378a15bc 100644 --- a/packages/docusaurus-utils/src/pathUtils.ts +++ b/packages/docusaurus-utils/src/pathUtils.ts @@ -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, '/'); diff --git "a/website/_dogfooding/_docs tests/tests/ascii/folder/\303\246\303\270\303\245.md" "b/website/_dogfooding/_docs tests/tests/ascii/folder/\303\246\303\270\303\245.md" new file mode 100644 index 000000000000..a74dbb5279d4 --- /dev/null +++ "b/website/_dogfooding/_docs tests/tests/ascii/folder/\303\246\303\270\303\245.md" @@ -0,0 +1 @@ +Dogfood test for https://github.com/facebook/docusaurus/pull/8137 diff --git "a/website/_dogfooding/_docs tests/tests/ascii/\303\246\303\270\303\245/index.md" "b/website/_dogfooding/_docs tests/tests/ascii/\303\246\303\270\303\245/index.md" new file mode 100644 index 000000000000..a74dbb5279d4 --- /dev/null +++ "b/website/_dogfooding/_docs tests/tests/ascii/\303\246\303\270\303\245/index.md" @@ -0,0 +1 @@ +Dogfood test for https://github.com/facebook/docusaurus/pull/8137