tonyofrancis / Fetch

The best file downloader library for Android
https://www.meta.stackoverflow.com/tags/fetch2
Apache License 2.0
1.66k stars 343 forks source link

Some times files get corrupt #419

Open jpvs0101 opened 5 years ago

jpvs0101 commented 5 years ago

Fetch 3.1.4x Standard config.

Download complete normally, everything seems normal. But some times files get corrupt. Also sometimes it failed to get file size. Old version 3.1.2 did not have this issue.

I can't reproduce it, but it might useful info to you!

tonyofrancis commented 5 years ago

@jpvs0101 Thanks for reporting. Are you able to share any urls? Here or via email?. Would love to test. Keeping this issue open to allow others with the same issue to post.

jpvs0101 commented 5 years ago

I noticed when download apks from www.apkpure.com. I guess mostly from dynamically generated links. But no issues when using old version (3.1.2) of Fetch!

Update: Users reporting this issue frequently 😕

tonyofrancis commented 5 years ago

Will test over the weekend

tonyofrancis commented 5 years ago

I have not been able to replicate this bug. Can you provide a url?. Sequential or Parallel downloading?

jpvs0101 commented 5 years ago

Try to download any apk from www.apkpure.com. Parallel download! Also I use SAF.

tonyofrancis commented 5 years ago

@jpvs0101 Tried reproducing this bug several times today with no luck. Tried several downloads from the apkpure website. Is it possible for you to share a sample project where this happens constantly?

jpvs0101 commented 5 years ago

Recently I find it here. Goto www.clipconverter.cc. Paste a video url to get download link. Try download using SAF setup. Also try in apkmirror site. Users also reporting when downloading PDFs on sites which needs signup.

Update 1: Just confirmed. Fetch version 3.1.0 works correctly, but latest version 3.1.4 has issues. I guess that the issue started when you play with range header. So please take a look.

Reproduce: Do pause / resume several times during download.

LathiyaVinal commented 4 years ago

I also getting same issue with version 3.1.4. It generates error " UNKNOWN" sometimes. So please take a look.

tonyofrancis commented 4 years ago

I think I have fixed this issue. Will do some more testing. Watch out for a new version of fetch in the next few days.

tonyofrancis commented 4 years ago

Hey at @jpvs0101. We have a new preview version of Fetch that should fix this issue. Please give it a try and let me know if it works well for you. I am going to wait a few days before releasing the full version.

implementation 'com.tonyodev.fetch2:fetch2:3.0.11-preview'
implementation 'androidx.tonyodev.fetch2:xfetch2:3.1.5-preview'
tonyofrancis commented 4 years ago

@jpvs0101 Any updates?

jpvs0101 commented 4 years ago

@tonyofrancis
Still issue exists! (I am using SAF + fetchOkhttp.)

Steps to reproduce:

Logs looks normal...

tonyofrancis commented 4 years ago

@jpvs0101 Just released another preview build. Spent the whole day working on this. I think it's finally fixed. Please test and let me know how it goes.

implementation 'com.tonyodev.fetch2:fetch2:3.0.11-preview2'
implementation 'androidx.tonyodev.fetch2:xfetch2:3.1.5-preview2'

Sorry about the long delay. It's been hectic on my end for quit sometime now.

tonyofrancis commented 4 years ago

New version of Fetch has been released. See readme for new version number.

jpvs0101 commented 4 years ago

@tonyofrancis Tested 3.1.5. Seems like download file corruption issue solved But it seems like we cannot pause/stop download sometimes which is annoying same as corrupted download. (I am not discouraging, but trying to help). Reproduce: Goto apkpure.com, download an apk, rapidly press pause/resume button. Now download can't be stopped normally. We have to force close app to stop download. Version 3.1.0 works good in this case.

tonyofrancis commented 4 years ago

@jpvs0101 I was able to replicate this behavior! . Looking into it

razi3742 commented 4 years ago

@tonyofrancis @jpvs0101 can any one tell how to use this library for post request

mreinhardt24 commented 4 years ago

@tonyofrancis No idea if this is related to the problem mentioned here but it seems like the onCompleted callback after resuming a download is not called in version 3.1.5. Also the progress callback seems to be missing the callback with 100%.

Version 3.1.0 works as expected. Maybe this helps.

NNirosan02 commented 4 years ago

This still an issue for others? Still getting a similar issue

fernandodeveloper commented 4 years ago

This still an issue for others? Still getting a similar issue

I I managed to solve mine by changing the download mode from Downloader.FileDownloaderType.PARALLEL to Downloader.FileDownloaderType.SEQUENTIAL

tonyofrancis commented 3 years ago

New update coming out later today. Will post back.

tonyofrancis commented 3 years ago

@jpvs0101 A new version of Fetch 3.0.12 & AndroidX version 3.1.6 has been released

jpvs0101 commented 3 years ago

@tonyofrancis Tried 3.1.6. Apkmirror works. Rapid pause/resume fixed. But goto http://tamilblasters.ws/ try download a torrent. Download successful. But file seems corrupt. Still 3.1.0 rocks!

anshul1235 commented 2 years ago

I got same issue, the file is corrupted after downloading.. (was able to reproduce with 2 image files both less then 5kb) if it helps sharing the file here. (works with SEQUENTIAL though). everything works fine in 3.1.0. @tonyofrancis img_1641551956283_01308675397049486996