-
Notifications
You must be signed in to change notification settings - Fork 114
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 behavior with escaped single quotes & brace expansion #480
Comments
In upstream dependencies [email protected] and [email protected], all tests with escaped single quotes pass: // [email protected]
require('micromatch').match(["fourth/file'sA.md", "fourth/file'sB.md"], "fourth/file\\'s{A,B}.md")
// [ "fourth/file'sA.md", "fourth/file'sB.md" ]
require('micromatch').match(["fifth's/fileA.md", "fifth's/fileB.md"], "fifth\\'s/file*.md")
// [ "fifth's/fileA.md", "fifth's/fileB.md" ]
require('micromatch').match(["fifth's/fileA.md", "fifth's/fileB.md"], "fifth\\'s/file{A,B}.md")
// [ "fifth's/fileA.md", "fifth's/fileB.md" ]
// [email protected]
require('braces')("fourth/file\\'s{A,B}.md", { expand: true })
// [ "fourth/file'sA.md", "fourth/file'sB.md" ]
require('braces')("fifth\\'s/file{A,B}.md", { expand: true })
// [ "fifth's/fileA.md", "fifth's/fileB.md" ] Reproduced test results on Windows 10. |
Thanks for the detailed description of the problem! There are several problems here. require("fast-glob").sync("fourth/file's{A,B}.md")
// => []
require("fast-glob").sync("fourth/file\\'s{A,B}.md")
// => ["fourth/file'sA.md", "fourth/file'sB.md"]
// Also
require("fast-glob").sync("fifth's/file{A,B}.md")
// => []
require("fast-glob").sync("fifth\\'s/file{A,B}.md")
// => [] This is happening because quotes may also be used as an alternative to backslashes for escaping. The The other solutions like wcmatch (python) and node-glob (js) do not follow this logic. The following behavior is correct because the pattern is used without changes. The require("fast-glob").sync("fifth's/file*.md")
// => ["fifth's/fileA.md", "fifth's/fileB.md"] This behavior is incorrect, because the base directory for the pattern should be require("fast-glob").sync("fifth\\'s/file*.md")
// => [] |
Environment
Actual behavior
On MacOS and Windows, escaping single quotes will cause some globs that otherwise fail (return no results) to succeed, but cause other globs that would otherwise succeed to fail.
Expected behavior
Steps to reproduce
Code sample
For this directory structure:
The following test is picky about single quotes being escaped:
The following test is picky about single quotes being UN-escaped:
The following test fails regardless of whether the quote is escaped or not:
The text was updated successfully, but these errors were encountered: