From 332c4657e501374c4277923984035802cc344993 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Sat, 8 Feb 2020 19:12:00 -0800 Subject: [PATCH] do not infinite download on 410, 400 --- .../antennapod/core/service/download/DownloadService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index f7c338729..10e271bb0 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -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) {