1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2025-01-21 21:31:32 +01:00

Only append to partially downloaded files if HTTP response is a 206

This commit is contained in:
Henry Le Grys 2021-03-10 01:31:31 +00:00
parent 4552b76465
commit cf7e12b4d1

View File

@ -290,9 +290,10 @@ public class HttpRequest implements Closeable, ProgressObservable {
public HttpRequest saveContent(File file) throws IOException, InterruptedException {
FileOutputStream fos = null;
BufferedOutputStream bos = null;
boolean shouldAppend = resumeInfo != null && getResponseCode() == 206;
try {
fos = new FileOutputStream(file, resumeInfo != null);
fos = new FileOutputStream(file, shouldAppend);
bos = new BufferedOutputStream(fos);
saveContent(bos);