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

Fix file URL double-encoding #1014

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

karlvr
Copy link
Contributor

@karlvr karlvr commented Feb 18, 2019

If the file URL contains percent encoding then the percent encodings are re-encoded, as we treat the already encoded string as a path, so NSURL re-encodes it. We can assume that if the string begins file:// that it is a legal file URL, in which case we can simply use [NSURL URLWithString].

Crash-- added a commit to cozy/SocialSharing-PhoneGap-Plugin that referenced this pull request Nov 19, 2019
@karlvr
Copy link
Contributor Author

karlvr commented Nov 30, 2020

@EddyVerbruggen this is still an issue in the plugin. It would be wonderful to resolve it. This currently means the plugin doesn't work if a file URL is supplied that contains % encoding.

@karlvr
Copy link
Contributor Author

karlvr commented Dec 1, 2020

If there are concerns about backwards compatibility due to JavaScript code creating invalid file:// URLs, then we could check to see if a file exists either way and use the form that exists?

Crash-- added a commit to cozy/SocialSharing-PhoneGap-Plugin that referenced this pull request Jan 2, 2023
If the file URL contains percent encoding then the percent encodings are re-encoded, as we treat the already encoded string as a path, so NSURL re-encodes it. We can assume that if the string begins file:// that it is a legal file URL, in which case we can simply use [NSURL URLWithString].
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

Successfully merging this pull request may close these issues.

1 participant