mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-02-11 16:59:54 +08:00
fix: cannot download library when .pack.xz responded not 404
This commit is contained in:
parent
9372d818a5
commit
b957ca1931
@ -214,11 +214,11 @@ public final class NetworkUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean urlExists(URL url) throws IOException {
|
public static boolean urlExists(URL url) throws IOException {
|
||||||
try (InputStream stream = url.openStream()) {
|
HttpURLConnection con = createConnection(url);
|
||||||
return true;
|
con = resolveConnection(con);
|
||||||
} catch (FileNotFoundException e) {
|
int responseCode = con.getResponseCode();
|
||||||
return false;
|
con.disconnect();
|
||||||
}
|
return responseCode / 100 == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==== Shortcut methods for encoding/decoding URLs in UTF-8 ====
|
// ==== Shortcut methods for encoding/decoding URLs in UTF-8 ====
|
||||||
|
Loading…
Reference in New Issue
Block a user