mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2026-02-26 05:51:12 +01:00
ExpansionSafety: Fix NPE & Only check files not directories
This commit is contained in:
@@ -55,9 +55,18 @@ public final class ExpansionSafetyCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Set<String> maliciousPaths = new HashSet<>();
|
final Set<String> maliciousPaths = new HashSet<>();
|
||||||
|
final File[] files = expansionsFolder.listFiles();
|
||||||
|
|
||||||
for (File file : expansionsFolder.listFiles()) {
|
if (files == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (File file : files) {
|
||||||
try {
|
try {
|
||||||
|
if (!file.isFile()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final String hash = Hashing.sha256().hashBytes(Files.asByteSource(file).read()).toString();
|
final String hash = Hashing.sha256().hashBytes(Files.asByteSource(file).read()).toString();
|
||||||
|
|
||||||
if (knownMaliciousExpansions.contains(hash)) {
|
if (knownMaliciousExpansions.contains(hash)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user