Fix #632
This commit is contained in:
@@ -29,10 +29,10 @@ import org.jackhuang.hmcl.util.Logging;
|
|||||||
import org.jackhuang.hmcl.util.StringUtils;
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
import org.jackhuang.hmcl.util.gson.JsonUtils;
|
import org.jackhuang.hmcl.util.gson.JsonUtils;
|
||||||
import org.jackhuang.hmcl.util.io.FileUtils;
|
import org.jackhuang.hmcl.util.io.FileUtils;
|
||||||
|
import org.jackhuang.hmcl.util.io.NetworkUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -72,9 +72,9 @@ public class ServerModpackCompletionTask extends Task<Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preExecute() throws Exception {
|
public void preExecute() {
|
||||||
if (manifest == null || StringUtils.isBlank(manifest.getManifest().getFileApi())) return;
|
if (manifest == null || StringUtils.isBlank(manifest.getManifest().getFileApi())) return;
|
||||||
dependent = new GetTask(new URL(manifest.getManifest().getFileApi() + "/server-manifest.json"));
|
dependent = new GetTask(NetworkUtils.toURL(manifest.getManifest().getFileApi() + "/server-manifest.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -125,7 +125,7 @@ public class ServerModpackCompletionTask extends Task<Void> {
|
|||||||
|
|
||||||
if (download) {
|
if (download) {
|
||||||
dependencies.add(new FileDownloadTask(
|
dependencies.add(new FileDownloadTask(
|
||||||
new URL(remoteManifest.getFileApi() + "/overrides/" + file.getPath()),
|
NetworkUtils.toURL(remoteManifest.getFileApi() + "/overrides/" + file.getPath()),
|
||||||
actualPath.toFile(),
|
actualPath.toFile(),
|
||||||
new FileDownloadTask.IntegrityCheck("SHA-1", file.getHash())));
|
new FileDownloadTask.IntegrityCheck("SHA-1", file.getHash())));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ public final class NetworkUtils {
|
|||||||
|
|
||||||
public static URL toURL(String str) {
|
public static URL toURL(String str) {
|
||||||
try {
|
try {
|
||||||
return new URL(str);
|
return new URL(URLEncoder.encode(str, "UTF-8"));
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||||
throw new IllegalArgumentException(e);
|
throw new IllegalArgumentException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user