diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/downloader/ListDownloader.java b/LauncherAPI/src/main/java/pro/gravit/launcher/downloader/ListDownloader.java index 643e50e3..741cdf3f 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/downloader/ListDownloader.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/downloader/ListDownloader.java @@ -47,10 +47,18 @@ public interface DownloadTotalCallback { public static class DownloadTask { public final String apply; - public final long size; + public long size; + public final String urlApply; public DownloadTask(String apply, long size) { this.apply = apply; + urlApply = apply; + this.size = size; + } + + public DownloadTask(String urlApply, String apply, long size) { + this.apply = apply; + this.urlApply = urlApply; this.size = size; } } @@ -70,7 +78,7 @@ public void download(String base, List applies, Path dstDirFile, D String path = baseUri.getPath(); List excs = new CopyOnWriteArrayList<>(); for (DownloadTask apply : applies) { - URI u = new URI(scheme, host, path + apply.apply, "", ""); + URI u = new URI(scheme, host, path + apply.urlApply, "", ""); callback.stateChanged(apply.apply, 0L, apply.size); Path targetPath = dstDirFile.resolve(apply.apply); toExec.add(() -> { @@ -181,7 +189,9 @@ public Path handleResponse(HttpResponse response) throws IOException { } long contentLength = response.getEntity().getContentLength(); if (task != null && contentLength != task.size) { - LogHelper.warning("Missing content length: expected %d | found %d", task.size, contentLength); + if (task.size > 0) + LogHelper.warning("Missing content length: expected %d | found %d", task.size, contentLength); + else task.size = contentLength; } if (zip) { try (ZipInputStream input = IOHelper.newZipInput(source)) { diff --git a/modules b/modules index 52818e6e..e098678d 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 52818e6ef05d90ad678d02e83f9bd4140d8eda34 +Subproject commit e098678d7ea2c5e6a926f457dcbc820c4e9fba66