-
Notifications
You must be signed in to change notification settings - Fork 52
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
Allow targetting specific file systems #11
Comments
Hey @parshap, sorry for the prolonged silence. I wrote some tests for this and found it to be too complicated to even justify the feature. And since then I've wondered if anyone would actually need it as a feature. So I propose we close this issue and only re-open it if we get a request from someone.. what do you think? |
No problem! But let's keep the issue open. |
Cool :) |
Been over an year and no one has requested anything. Guess this can be closed now. |
If this project was overwhelmed with open issues I'd close it, but I'll leave it open so it's visible and can be discussed it if anyone has ideas or use cases. |
Hi Its far to restrictive for *nix systems, where almost all characters are legal and used in filenames (even wildcards and quotes) It should IMO at least have a global option, or even better, check with os.platform() Best regards |
You could add something like this: if( os.platform() != 'win32' ) |
Hi @paragi. If you use I think an option for users to optionally specify what target systems to sanitize for (defaulting to all) would be great. Would you be interested in implementing that? |
Hi @parshap Application are often meant for a specific purpose, on a specific platform. Therefore I subscribe to the view that; a library/module should default to support the platform its running on. I would suggest something like this:
Even wildcards pipe and quotes are legal. (if a little awkward at times :) An option to sanitize more, and for windows compability, would of cause be nice :) |
Yes, sanitizing for Windows is complex, but it already works well here. Changing this would be breaking for existing users and I think creating filenames that are safe for use across platforms is a common use case so we should continue to support that. I'm open to adding Unix-only sanitization as an option, but I am not open to changing the default behavior. |
I respect that, and I thank you for a nice and easy to use tool, for windows filenames. |
It's not just OSes; one could use this package to sanitize filenames before storing in a database or before outputting on HTML pages. So I wouldn't tie this package up to file systems specifically. Note: I'm aware of this package being node only, but given it's generic nature, this can easily be transformed into a UMD package. I would actually vote for that - make this isomorphic! |
Indeed! This package already works in a browser context via Browserify, Webpack, etc. In fact we run real browsers tests in CI via Sauce Labs: node-sanitize-filename/.travis.yml Line 46 in 0d21bf1
See also #37. |
My use-case for FAT32 filenames is that it's still kind of the lowest common denominator in terms of OS support. As such, Linux distributions often default to FAT32 for formatting flash drives (NTFS is not supported by macOS and I believe there may be legal issues with exFAT). As such, I would love to be able to produce filenames that are FAT32-compatible. |
Currently given strings are sanitized against all known file systems' requirements. It would be nice to allow the user to specify the file system they need to protect against.
See discussion in #9.
The text was updated successfully, but these errors were encountered: