-
Notifications
You must be signed in to change notification settings - Fork 135
URL paths are decoded prior to request on Android #62
Comments
Have the same problem! |
does any one know how to fix this? |
@arasrezaei I was unable to find a solution - we ended up restructuring our Firebase storage to avoid it 😒 |
Good morning, I had problems with this topic. Finally use JS's own encodeURI (). It seems to work. |
@mcasami-frit encodeURI() doesn't work for me. @SpenceDiNicolantonio Do you store all the images on root without any subfolder? But it will mess up the structure. @arasrezaei Me too, having this issue on android. Any solution for android? |
same here |
Same thing here. Works on iOS but not on Android. I use https://github.com/ljharb/qs And as soon as one of the values has to be encoded this breaks on android. I dug around a bit and it seems as though the android version calls "setParams" no matter if you actually have params or not. And the "shouldEncode" argument to the method is forced to "true". I've tried disabling the encoding from qs entirely and then I get a "URISyntaxException", which is weird, since it should then handle the encoding. Setting the "shouldEncode" argument to "false" causes a "MalformedURLException", even if you provide an encoded URL, this is because the URL concatenation when shouldEncode is false does not add "://" after the protocol. Encoding the entire string in qs and then removing the call to setParams in the android makes it work.. |
Describe the bug
When making a request to a URL that includes encoded characters (e.g.
%2F
), those character sequences are decoded prior to making the the request. This breaks requests that expect such escape sequences (e.g. Firebase storage refs).Example:
https://firebasestorage.googleapis.com/v0/b/xxxxxx/o/path%2Fto%2Ffile.json
becomeshttps://firebasestorage.googleapis.com/v0/b/xxxxxx/o/path/to/file.json
This is caused by the following line in the
setParams()
method, due to the use ofURI.getPath()
which returns a decoded path:URI newUri = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), newQuery, uri.getFragment());
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A request is made to the provided URL, as it was provided
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: