do not infinite download on 410, 400

This commit is contained in:
Tony Tam 2020-02-08 19:12:00 -08:00
parent 67971af3aa
commit 332c4657e5
1 changed files with 6 additions and 1 deletions

View File

@ -336,7 +336,12 @@ public class DownloadService extends Service {
&& String.valueOf(HttpURLConnection.HTTP_FORBIDDEN).equals(status.getReasonDetailed());
boolean notEnoughSpace = status.getReason() == DownloadError.ERROR_NOT_ENOUGH_SPACE;
boolean wrongFileType = status.getReason() == DownloadError.ERROR_FILE_TYPE;
if (httpNotFound || forbidden || notEnoughSpace || wrongFileType) {
boolean httpGone = status.getReason() == DownloadError.ERROR_HTTP_DATA_ERROR
&& String.valueOf(HttpURLConnection.HTTP_GONE).equals(status.getReasonDetailed());
boolean httpBadReq = status.getReason() == DownloadError.ERROR_HTTP_DATA_ERROR
&& String.valueOf(HttpURLConnection.HTTP_BAD_REQUEST).equals(status.getReasonDetailed());
if (httpNotFound || forbidden || notEnoughSpace || wrongFileType || httpGone || httpBadReq ) {
try {
DBWriter.saveFeedItemAutoDownloadFailed(item).get();
} catch (ExecutionException | InterruptedException e) {