mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Разделение url и пути в ListDownloader.
This commit is contained in:
parent
6b85de2806
commit
31c32aa2c2
2 changed files with 14 additions and 4 deletions
|
@ -47,10 +47,18 @@ public interface DownloadTotalCallback {
|
||||||
|
|
||||||
public static class DownloadTask {
|
public static class DownloadTask {
|
||||||
public final String apply;
|
public final String apply;
|
||||||
public final long size;
|
public long size;
|
||||||
|
public final String urlApply;
|
||||||
|
|
||||||
public DownloadTask(String apply, long size) {
|
public DownloadTask(String apply, long size) {
|
||||||
this.apply = apply;
|
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;
|
this.size = size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +78,7 @@ public void download(String base, List<DownloadTask> applies, Path dstDirFile, D
|
||||||
String path = baseUri.getPath();
|
String path = baseUri.getPath();
|
||||||
List<IOException> excs = new CopyOnWriteArrayList<>();
|
List<IOException> excs = new CopyOnWriteArrayList<>();
|
||||||
for (DownloadTask apply : applies) {
|
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);
|
callback.stateChanged(apply.apply, 0L, apply.size);
|
||||||
Path targetPath = dstDirFile.resolve(apply.apply);
|
Path targetPath = dstDirFile.resolve(apply.apply);
|
||||||
toExec.add(() -> {
|
toExec.add(() -> {
|
||||||
|
@ -181,7 +189,9 @@ public Path handleResponse(HttpResponse response) throws IOException {
|
||||||
}
|
}
|
||||||
long contentLength = response.getEntity().getContentLength();
|
long contentLength = response.getEntity().getContentLength();
|
||||||
if (task != null && contentLength != task.size) {
|
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) {
|
if (zip) {
|
||||||
try (ZipInputStream input = IOHelper.newZipInput(source)) {
|
try (ZipInputStream input = IOHelper.newZipInput(source)) {
|
||||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
||||||
Subproject commit 52818e6ef05d90ad678d02e83f9bd4140d8eda34
|
Subproject commit e098678d7ea2c5e6a926f457dcbc820c4e9fba66
|
Loading…
Reference in a new issue