diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FileDownloadTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FileDownloadTask.java index 14ce4a34f..7c0edcbf6 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FileDownloadTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FileDownloadTask.java @@ -234,6 +234,10 @@ public class FileDownloadTask extends Task { } catch (IOException e) { Logging.LOG.log(Level.WARNING, "Unable to use cached file, redownload it", e); repository.removeRemoteEntry(con); + // Now we must reconnect the server since 304 may result in empty content, + // if we want to redownload the file, we must reconnect the server without etag settings. + repeat--; + continue; } } else if (con.getResponseCode() / 100 != 2) { throw new ResponseCodeException(url, con.getResponseCode());