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

Double enconding on Android #195

Closed
Hanzofm opened this issue Mar 27, 2019 · 4 comments
Closed

Double enconding on Android #195

Hanzofm opened this issue Mar 27, 2019 · 4 comments
Labels

Comments

@Hanzofm
Copy link

Hanzofm commented Mar 27, 2019

Hi,

I am trying to download a file with a path like:

https://mydomain.com/file has spaces.pdf

I am obtaining this error:

{"status":-1,"error":"There was an error with the given filePath"}

If I do a previous 'encodeURI' the problem is that on Android the plugin do a double enconding for example:

https://mydomain.com/file%20has%20spaces.pdf

is transformed into

https://mydomain.com/file%2520has%2520spaces.pdf

On iOS it works correctly if I previously encode the urls

My version of the plugin is 2.0.4 and the ionic wrapper version is 4.18.0

What would be the problem?

Related issue:
#96

@testanddeploy
Copy link

+1

@silkimen
Copy link
Owner

silkimen commented Apr 4, 2019

Please try v2.0.7, it should be fixed now. You'll need to encode the base URL yourself whereas query parameters (second argument) will be encoded automatically.

cordova.plugin.http.downloadFile(urlNotEncodedAutomatically, paramsObjectEncodedAutomatically, headers, filePath, successHandler, errorHandler);

@silkimen
Copy link
Owner

silkimen commented Apr 7, 2019

Closing this, feel free to open a new issue, if this won't solve your problem!

@silkimen silkimen closed this as completed Apr 7, 2019
@Hanzofm
Copy link
Author

Hanzofm commented Apr 9, 2019

Solved on Android, now it fails on iOS :(

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

No branches or pull requests

3 participants