Fixed my mistake.

This commit is contained in:
zaxar163 2018-12-02 15:46:21 +03:00
parent f879c98995
commit 2676cd0dde
No known key found for this signature in database
GPG key ID: E3B309DD3852DE06
2 changed files with 2 additions and 15 deletions

View file

@ -77,9 +77,8 @@ function offlineUpdateRequest(dirName, dir, matcher, digest) {
return; return;
} }
// Verify dir with matcher using ClientLauncher's API // Verify dir with matcher using FunctionalBridge`s API
ClientLauncher.verifyOffline(dir, hdir.object, matcher, digest); return FunctionalBridge.offlineUpdateRequest(dir, hdir, matcher, digest).run();
return hdir;
}; };
} }

View file

@ -551,18 +551,6 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir))); throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
} }
// Hack: this will break patcher because there are 2 functions with one body...
@LauncherAPI
public static void verifyOffline(Path dir, HashedDir hdir, FileNameMatcher matcher, boolean digest) throws IOException {
if (matcher != null)
matcher = matcher.verifyOnly();
// Hash directory and compare (ignore update-only matcher entries, it will break offline-mode)
HashedDir currentHDir = new HashedDir(dir, matcher, true, digest);
if (!hdir.diff(currentHDir, matcher).isSame())
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
}
private ClientLauncher() { private ClientLauncher() {
} }
} }