Skip to content

fix(config): don't unescape glob characters in Windows input paths - #23385

Open
szupzj18 wants to merge 1 commit into
vitejs:mainfrom
szupzj18:chris/fix/windows-input-glob-unescape
Open

fix(config): don't unescape glob characters in Windows input paths#23385
szupzj18 wants to merge 1 commit into
vitejs:mainfrom
szupzj18:chris/fix/windows-input-glob-unescape

Conversation

@szupzj18

Copy link
Copy Markdown

Description

Fixes #23383.

Top-level input paths are normalized through unescapeGlobCharacters, which unescapes glob characters reserved for future glob support (\@@, \[[, …). On Windows, backslash is the path separator, so any path segment starting with one of *?[]{}()!+@| was corrupted: D:\desk\test\@src\whatever.html became D:\desk\test@src\whatever.html, and the dependency scan failed with failed to resolve rolldownOptions.input value.

Root cause

normalizeInput ran value.replace(/\\([*?[\]{}()!+@|])/g, '$1') unconditionally. On POSIX, \ only appears as an escape character in input, so the unescape is correct. On Windows, every \ is a path separator, and \@ (separator + @-segment) was wrongly treated as an escaped @.

Change

Skip the unescape on Windows. Backslash is always a path separator there, and the glob characters that are legal in Windows filenames ([, ], (, ), !, +, @) no longer need unescaping — isDynamicPattern already treats \[ etc. as escaped, so they pass the glob check and are now preserved as-is.

The support escaped input test is now POSIX-only (test.skipIf(isWindows)), since escaping glob characters with a backslash is inherently incompatible with Windows path separators.

Validation

  • New Windows-gated regression cases in config.spec.ts (segments starting with @, !, +, (, [, plus a relative path).
  • Verified locally against the real tinyglobby isDynamicPattern: on current main all Windows path variants are corrupted (RED); with this fix they are preserved (GREEN), and POSIX escaped-glob behavior (src/\*.tssrc/*.ts) is unchanged.
  • config.spec.ts: 109/109 pass. ESLint/oxfmt clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot: maybe Maybe a bot, LLM, or agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependency scan fails with incorrect file path when input contains @ in directory name on Windows

1 participant