Вернул проверку runtime

This commit is contained in:
Gravit 2018-10-27 00:23:27 +07:00
parent 4f65a0a396
commit e82359a347
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -89,9 +89,15 @@ public static void setConfig(LauncherConfig cfg)
@LauncherAPI @LauncherAPI
public static URL getResourceURL(String name) throws IOException { public static URL getResourceURL(String name) throws IOException {
LauncherConfig config = getConfig();
byte[] validDigest = config.runtime.get(name);
if (validDigest == null)
throw new NoSuchFileException(name);
// 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;