-
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
Escaping paths with backslashes in dir names #262
Comments
Thanks for the question! You are right that multiple escaping will not work. Right now, I don't see any serious reasons to complicate the escape method, because the current problem looks like an edge case. Looks like some form of an enhancement for the future.. |
@mrmlnc The problem doesn't only occur in such edge case, but also occurs if the path name includes parenthesis " |
@liqian5365 This issue is about backslashes. What you wrote doesn't seem to be related. If you believe you encountered a bug, please open another issue with a proper report (steps to reproduce, actual results, expected results). |
Actually, there are several problems here:
Mark this issue as a bug. I currently don't have any ideas on how to fix this correctly. I think we should start by fixing the first point. |
Environment
Steps to reproduce
a\
and a file in it.escapePath
to compose a glob to match files inside this dir.Code sample
Actual behavior
Nothing found.
Expected behavior
The file is found.
escapePath('a\\')
returns the same string'a\\'
. The backslash is not understood byfast-glob
as a literal character. It needs to be escaped somehow.fastGlob.sync('a\\\\/*')
doesn't work, butfastGlob.sync('a@(\\\\)/*')
does.This is further complicated by another bug:
escapePath
doesn't escape special characters if they're already preceded by a backslash:escapePath('a\\*') === 'a\\*'
.The text was updated successfully, but these errors were encountered: