From d4eabbc4c0112dc8ce72ea6632cf4fdb73aab347 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Sat, 6 May 2023 00:25:48 +0700 Subject: [PATCH] [FIX] Remove digest check --- .../src/main/java/pro/gravit/launcher/Launcher.java | 4 ---- .../src/main/java/pro/gravit/utils/helper/JavaHelper.java | 8 +++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/Launcher.java b/LauncherAPI/src/main/java/pro/gravit/launcher/Launcher.java index 28bb2374..27457da0 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/Launcher.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/Launcher.java @@ -76,8 +76,6 @@ public static URL getResourceURL(String name) throws IOException { // Resolve URL and verify digest 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 url; @@ -91,8 +89,6 @@ public static URL getResourceURL(String name, String prefix) throws IOException // Resolve URL and verify digest 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 url; diff --git a/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java b/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java index 8c52aa53..6a9ec45d 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java @@ -119,7 +119,13 @@ private static JavaVersion tryFindJavaByPath(Path path) { public static void tryAddJava(List javaPaths, List result, JavaVersion version) { 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; javaPaths.add(path); result.add(version);