-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent File Format Handling Between Windows and POSIX in fast-glob #425
Comments
This also affects my Nuxt project, where I use Prettier to format files on commit. For instance, a file named |
Having this issue on an astro project |
Using |
Fixed in the |
The reported issue has been fixed. I'll go ahead and close this now. Thanks to @mrmlnc for the quick resolution |
Was this released on npm under 3.3.2 or 3.3.1? I can't see in NPM :(. |
Environment
Actual behavior
Hello,
I'd like to report an issue that was initially raised on the Prettier repository prettier/prettier#15426, but ultimately led us to examine Fast-glob. It turns out that Prettier uses Fast-glob to resolve patterns, especially for Prettier-cli. Specifically, in my case, it's about the following command:
npx prettier --write [...nextauth].ts
, which seems to be a filename format accepted on all operating systems.It appeared to me that Fast-glob uses two different patterns, one for POSIX systems and another for Windows:
See: https://github.com/mrmlnc/fast-glob/blob/28a3d61e44d5d9193ba97de4f21df6dc7725f7c0/src/utils/path.ts#L13C1-L14C94
which ends up giving two different behaviors depending on whether you are on Linux or Windows.
I don't know the full implications of this, but I know that for my example the brackets "[]" in Windows are not escaped when we call the escapePath() method
This returns on Linux
and on Windows.
Expected behavior
I believe that if Windows supports this naming format for these files, then Fast-glob should ensure it conforms to it.
Steps to reproduce
on windows:
pwsh or cmd:
Code sample
A faster way to see the difference, although you'll have to trust me for the code I obtained from Fast-glob.
I've included only the essentials to reproduce the problem:
The text was updated successfully, but these errors were encountered: