fix: download empty file from MCBBS

This commit is contained in:
huanghongxun
2020-02-20 14:35:10 +08:00
parent 5c19dcd208
commit 0b0118446f

View File

@@ -234,6 +234,10 @@ public class FileDownloadTask extends Task<Void> {
} 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());