From c76e451210f41c8c3d4285928983adcadcc5da30 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Sun, 21 Jul 2024 19:50:51 +0700 Subject: [PATCH] [FIX] Backport: Downloader truncate file --- .../src/main/java/pro/gravit/launcher/modern/Downloader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LauncherModernCore/src/main/java/pro/gravit/launcher/modern/Downloader.java b/LauncherModernCore/src/main/java/pro/gravit/launcher/modern/Downloader.java index bed2563e..26f7ab6d 100644 --- a/LauncherModernCore/src/main/java/pro/gravit/launcher/modern/Downloader.java +++ b/LauncherModernCore/src/main/java/pro/gravit/launcher/modern/Downloader.java @@ -240,7 +240,7 @@ protected HttpRequest makeHttpRequest(URI baseUri, String filePath) throws URISy } protected ProgressTrackingBodyHandler makeBodyHandler(Path file, DownloadCallback callback) { - return new ProgressTrackingBodyHandler<>(HttpResponse.BodyHandlers.ofFile(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE), callback); + return new ProgressTrackingBodyHandler<>(HttpResponse.BodyHandlers.ofFile(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING), callback); } public interface DownloadCallback {