fix(utils): remove non-ASCII limitation for path normalization (#8137)

This commit is contained in:
Johan Fagerberg 2022-10-07 13:35:12 +02:00 committed by GitHub
parent efbd0cbd40
commit 6c8af03f51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 7 deletions

View file

@ -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, '/');