[FIX] Разделение url и пути в ListDownloader.

This commit is contained in:
zaxar163 2019-11-16 20:38:59 +03:00
parent 6b85de2806
commit 31c32aa2c2
2 changed files with 14 additions and 4 deletions

View file

@ -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<DownloadTask> applies, Path dstDirFile, D
String path = baseUri.getPath();
List<IOException> 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)) {

@ -1 +1 @@
Subproject commit 52818e6ef05d90ad678d02e83f9bd4140d8eda34
Subproject commit e098678d7ea2c5e6a926f457dcbc820c4e9fba66