fix windows escaping (and broken tests) (#19011)

This commit is contained in:
Tommaso Sciortino
2026-02-13 14:19:08 -08:00
committed by GitHub
parent c7237f0c79
commit e7e4c68c5c
4 changed files with 16 additions and 14 deletions

View File

@@ -277,8 +277,8 @@ export function makeRelative(
*/
export function escapePath(filePath: string): string {
if (process.platform === 'win32') {
// Windows: Double quote if it contains space or special chars
if (/[\s()[\]{};|&^$!@%`'~]/.test(filePath)) {
// Windows: Double quote if it contains special chars
if (/[\s&()[\]{}^=;!'+,`~%$@#]/.test(filePath)) {
return `"${filePath}"`;
}
return filePath;