[FIX] Remove digest check

This commit is contained in:
Gravita 2023-05-06 00:25:48 +07:00
parent 540ad0b0da
commit d4eabbc4c0
2 changed files with 7 additions and 5 deletions

View file

@ -76,8 +76,6 @@ public static URL getResourceURL(String name) throws IOException {
// Resolve URL and verify digest // Resolve URL and verify digest
URL url = IOHelper.getResourceURL(RUNTIME_DIR + '/' + name); URL url = IOHelper.getResourceURL(RUNTIME_DIR + '/' + name);
if (!Arrays.equals(validDigest, SecurityHelper.digest(SecurityHelper.DigestAlgorithm.MD5, url)))
throw new NoSuchFileException(name); // Digest mismatch
// Return verified URL // Return verified URL
return url; return url;
@ -91,8 +89,6 @@ public static URL getResourceURL(String name, String prefix) throws IOException
// Resolve URL and verify digest // Resolve URL and verify digest
URL url = IOHelper.getResourceURL(prefix + '/' + name); URL url = IOHelper.getResourceURL(prefix + '/' + name);
if (!Arrays.equals(validDigest, SecurityHelper.digest(SecurityHelper.DigestAlgorithm.MD5, url)))
throw new NoSuchFileException(name); // Digest mismatch
// Return verified URL // Return verified URL
return url; return url;

View file

@ -119,7 +119,13 @@ private static JavaVersion tryFindJavaByPath(Path path) {
public static void tryAddJava(List<String> javaPaths, List<JavaVersion> result, JavaVersion version) { public static void tryAddJava(List<String> javaPaths, List<JavaVersion> result, JavaVersion version) {
if (version == null) return; if (version == null) return;
String path = version.jvmDir.toAbsolutePath().toString(); Path realPath = version.jvmDir.toAbsolutePath();
try {
realPath = realPath.toRealPath();
} catch (IOException ignored) {
}
String path = realPath.toString();
if (javaPaths.contains(path)) return; if (javaPaths.contains(path)) return;
javaPaths.add(path); javaPaths.add(path);
result.add(version); result.add(version);