Skip to content
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

What characters does the default setting allow in a file/folder path/name? #60

Closed
kunalkaroth opened this issue Sep 12, 2018 · 3 comments

Comments

@kunalkaroth
Copy link

On Windows, special file characters: , /, :, *, ?, ", |, <, > are not allowed for file / folder names.
On *NIX/MAC, special file characters: \0, / are not allowed.

I hope the library honours this? :)

@dazinator
Copy link
Owner

dazinator commented Sep 14, 2018

You can see #52 for some history on this.
by honour I think you mean that it shouldn't allow you to construct glob patterns that have characters that are invalid for the file system of the platform you are running on? Is that right? If so - it used to have this as a setting and would throw an exception if an invalid character was specified in the glob pattern. The problem with this setting is that the "allowable" file path characters differs a lot from platform to platform and was very confusing and frustrating to get a definitive answer too. Also, globbing on file system paths is not the only use case, I have seen people using this library to glob against windows registry entries, or url's etc so this setting wasn't valuable in those cases. Technically I don't see much value in dotnet glob making any kind of assumption about the underlying input string - i.e assuming it will always be a file system path is unnecessary coupling in my opinion. The only case I can think of where this might be a problem is where you allow users to input their own glob pattern for a search against the local file system, and you construct a glob from it without doing any sanitisation to check for invalid file system characters. Is this the use case you have in mind? If so, it seems it could potentially be handled by sanitising the user's input first?

@dazinator
Copy link
Owner

Closing this for now. If this is causing you some sort of exception or problem please feel free to comment further and i'll reopen if necessary.

@kunalkaroth
Copy link
Author

Thanks for the detailed explanation. On top of what you mention, there could be instances where windows is running on mac etc. In such cases the semantics become even more murkier. I agree with you. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants