Merge pull request #3848 from tonytamsf/fix-4xx-http-error

do not infinite download on 410, 400
This commit is contained in:
H. Lehmann 2020-02-13 16:08:05 +01:00 committed by GitHub
commit b268390c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) {