mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-02-05 16:44:47 +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 {
|
||||
try (InputStream stream = url.openStream()) {
|
||||
return true;
|
||||
} catch (FileNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
HttpURLConnection con = createConnection(url);
|
||||
con = resolveConnection(con);
|
||||
int responseCode = con.getResponseCode();
|
||||
con.disconnect();
|
||||
return responseCode / 100 == 2;
|
||||
}
|
||||
|
||||
// ==== Shortcut methods for encoding/decoding URLs in UTF-8 ====
|
||||
|
Loading…
Reference in New Issue
Block a user