tanoDxyz / GDownload

Light Weight, Fast 🚀 , Easy to Use, Reliable Download client for android.
Apache License 2.0
39 stars 2 forks source link

download json file error #3

Closed freehussain closed 1 year ago

freehussain commented 1 year ago

hello,

i'm trying to download json file but there are error:

get file length isn't true downloaded file corrupted

here is a link for download file example https://files.goldenquran.org/quraan_tafser/11_v5.json

please also if there a chance i need direct connection with you

tanoDxyz commented 1 year ago

first i have checked the file link you provided.

opened it with chrome and edge. the file is valid json file. there are a lot of \u064 Unicode chars. i would suggest convert the unicode codepoints to characters.

second you said file length was not true. library will still download the file. did your downloaded succeed?

freehussain commented 1 year ago

hello,

these characters supposed to be arabic letters please check the image bellow.

before i use your library it was successfully downloaded by the following code

val request = Request.Builder().url(URL(url)).build() val response = OkHttpClient().newCall(request).execute()

for downloading file it works but downloaded file looks strange, something like binary file what do you think the issue is?

Screenshot 2023-03-30 at 6 20 04 AM
tanoDxyz commented 1 year ago

Dear! on your request i downloaded this file via different methods.

I used plain browsers on PC - Chrome, opera , edge

UsedEagleGetdownloader for pc

than on android devices i downloaded this file via okHttp as well. okhttp download code

from all the sources it gave the exact same result

finally used PostMan for PC it just showed the characters in arabic.

I will summarize it as follows

it is the renderer in our case it is Post Man that shows those unicode chars properly.

freehussain commented 1 year ago

hello,

although there is a two files on the same storage but with different extension, the second files(as in the image below) can be downloaded with correct length and correct content.

please check the header response it looks like the same but deferent behave

Screenshot 2023-03-30 at 3 11 58 PM

what do you think the issue is?

tanoDxyz commented 1 year ago

ok i found the issue. basically by default accept-encoding header was sent with request body and that was causing the problem. and i updated the repo via quick patch.

you can try
implementation 'com.github.tanoDxyz:GDownload:1.1'

thank you so much.

freehussain commented 1 year ago

thank you alot for your kindness, it works now

please give me your phone number or twitter, we may have a good chance for job

tanoDxyz commented 1 year ago

Skype =

s.tanveer.h