[FIX] Фикс ListDownloader

This commit is contained in:
Gravit 2019-04-03 22:21:11 +07:00
parent 08f7a98dbb
commit a9bba37df7
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 6 additions and 2 deletions

View file

@ -26,7 +26,7 @@ public void download(String base, List<String> applies, Path dstDirFile) throws
HttpGet get = null; HttpGet get = null;
for (String apply : applies) { for (String apply : applies) {
URI u = new URL(base.concat(apply)).toURI(); URI u = new URL(base.concat(escapeURL(apply))).toURI();
LogHelper.debug("Download URL: %s", u.toString()); LogHelper.debug("Download URL: %s", u.toString());
if (get == null) get = new HttpGet(u); if (get == null) get = new HttpGet(u);
else { else {
@ -37,6 +37,10 @@ public void download(String base, List<String> applies, Path dstDirFile) throws
} }
} }
} }
public String escapeURL(String apply)
{
return apply.replaceAll(" ", "%20");
}
static class FileDownloadResponseHandler implements ResponseHandler<Path> { static class FileDownloadResponseHandler implements ResponseHandler<Path> {
private final Path target; private final Path target;

View file

@ -207,7 +207,7 @@ public UpdateRequestEvent requestWebSockets() throws Exception {
HashedDir.Diff diff = e.hdir.diff(localDir, matcher); HashedDir.Diff diff = e.hdir.diff(localDir, matcher);
final List<String> adds = new ArrayList<>(); final List<String> adds = new ArrayList<>();
diff.mismatch.walk(IOHelper.CROSS_SEPARATOR, (path, name, entry) -> { diff.mismatch.walk(IOHelper.CROSS_SEPARATOR, (path, name, entry) -> {
if(entry.getType() == HashedEntry.Type.FILE) adds.add(path.replaceAll(" ","%20")); if(entry.getType() == HashedEntry.Type.FILE) adds.add(path);
}); });
totalSize = diff.mismatch.size(); totalSize = diff.mismatch.size();
startTime = Instant.now(); startTime = Instant.now();