-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix glob pattern matching on Windows by normalizing path separators #2204
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
…lashes Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
…ing() Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
|
|
||
| // Convert to forward slashes on Windows before matching with minimatch | ||
| // since the pattern was converted to forward slashes in the constructor | ||
| if (IS_WINDOWS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added duplicated code? Could we refactor it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored the duplicated code into a private static helper method convertToMinimatchPath(). This method is now used in both match() and partialMatch() methods. (9de8f6f)
…lication Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
|
'path' is defined but never used @copilot |
Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
|
You should probably run npm linting with the fix option @copilot |
Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
Fix glob not working on Windows
Root Cause Analysis
The issue is in
packages/glob/src/internal-pattern.tsin thematch()andpartialMatch()methods:/) for minimatch on Windows\) on WindowsImplementation Plan
Security Summary
CodeQL analysis completed with 0 alerts - no security vulnerabilities found.
Changes Made
convertToMinimatchPath()to eliminate code duplicationOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.