Check file size after download

This commit may address symptoms seen in #187 and #197 where
AntennaPod did not flag incomplete downloads as failed.
This commit is contained in:
Andrew Gaul 2013-06-30 22:02:59 -07:00
parent 941fa9062e
commit e99c7931f7
1 changed files with 9 additions and 0 deletions

View File

@ -114,6 +114,15 @@ public class HttpDownloader extends Downloader {
onCancelled();
} else {
out.flush();
if (status.getSize() != DownloadStatus.SIZE_UNKNOWN &&
status.getSoFar() != status.getSize()) {
onFail(DownloadError.ERROR_IO_ERROR,
"Download completed but size: " +
status.getSoFar() +
" does not equal expected size " +
status.getSize());
return;
}
onSuccess();
}
} else {