[FIX] Backport: Downloader truncate file

This commit is contained in:
Gravita 2024-07-21 19:50:51 +07:00
parent a53b18ae68
commit c76e451210
No known key found for this signature in database
GPG key ID: 543A8F335C9CD633

View file

@ -240,7 +240,7 @@ protected HttpRequest makeHttpRequest(URI baseUri, String filePath) throws URISy
}
protected ProgressTrackingBodyHandler<Path> 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 {