From a9bba37df78bc50eb750d134f4423aa18e1f3d35 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 3 Apr 2019 22:21:11 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=A4=D0=B8=D0=BA=D1=81=20ListDownload?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/ru/gravit/launcher/downloader/ListDownloader.java | 6 +++++- .../ru/gravit/launcher/request/update/UpdateRequest.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java b/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java index 21d57482..6bda4b15 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/downloader/ListDownloader.java @@ -26,7 +26,7 @@ public void download(String base, List applies, Path dstDirFile) throws HttpGet get = null; 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()); if (get == null) get = new HttpGet(u); else { @@ -37,6 +37,10 @@ public void download(String base, List applies, Path dstDirFile) throws } } } + public String escapeURL(String apply) + { + return apply.replaceAll(" ", "%20"); + } static class FileDownloadResponseHandler implements ResponseHandler { private final Path target; diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java index 3158e8f8..03812156 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java @@ -207,7 +207,7 @@ public UpdateRequestEvent requestWebSockets() throws Exception { HashedDir.Diff diff = e.hdir.diff(localDir, matcher); final List adds = new ArrayList<>(); 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(); startTime = Instant.now();