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

Handling of %20 #15

Closed
michaelhkay opened this issue Jun 14, 2020 · 3 comments
Closed

Handling of %20 #15

michaelhkay opened this issue Jun 14, 2020 · 3 comments

Comments

@michaelhkay
Copy link

Am I right in thinking this library makes no attempt to convert My%20Documents to My Documents? Is that by design?

@papb
Copy link

papb commented Jun 15, 2020

Yes, I guess this is by design. % is not a valid character, files can be named foo%20bar.txt without any problem.

Even though I see your point, that %20 could be normalized to a space, and other percent-enconded values could be converted as well... But since the goal of this library is simply to generate valid filenames, it does not have to do anything with %20.

@michaelhkay
Copy link
Author

Fair enough. What we need is something that approximates to round-tripping between filenames and URIs, and it seems this library isn't it. Yes, of course I know perfect round-tripping isn't possible for the reasons you give, we just have to do the best we can.

@sindresorhus
Copy link
Owner

You can just run it through decodeURIComponent first, or use https://github.com/sindresorhus/filenamify-url

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

3 participants