amitshekhariitbhu / Fast-Android-Networking

πŸš€ A Complete Fast Android Networking Library that also supports HTTP/2 πŸš€
https://outcomeschool.com
Apache License 2.0
5.71k stars 960 forks source link

fixed an upload issue when file name contains arabic/persian numbers #563

Open MansourM opened 3 years ago

MansourM commented 3 years ago

Hey man, great library, i've been using it for some time and it made my life much easier :D

there was a tricky issue with file uploads, when there are arabic/persian numbers in file name (or maybe also some other languages) the library wont upload the file as was stated in this issue](https://github.com/amitshekhariitbhu/Fast-Android-Networking/issues/491) the thing that makes it extra tricky is the fact that you can have an image in your phone with the name "image123.png" when you upload the image on (EN) locale everything is fine, but if you change the Locale to Persian (FA), getting the file URI/name from android will return then name with Persian numbers, and even if you try to fetch the "image123.png" it cant find it, you need to use the name with pesian number :D, pretty weird ;D

the root of the problem was the fact that, okhttp header will not accept these numbers as valid characters for the header, i worked around it by URL Encoding the name and adding a new method that has an extra encoding parameter when making Multipart files.

it can probably be done in a cleaner way, ill leave that to you

Have a nice day.

MansourM commented 3 years ago

this seems to be addressed here and fixed here , and your are using 3.10 which is after this pull, not sure why its still giving us this error ;(