diff --git a/src/main/java/dev/encode42/meows/filesystem/ModFilesystem.java b/src/main/java/dev/encode42/meows/filesystem/ModFilesystem.java index 214a219..1047d7b 100644 --- a/src/main/java/dev/encode42/meows/filesystem/ModFilesystem.java +++ b/src/main/java/dev/encode42/meows/filesystem/ModFilesystem.java @@ -106,12 +106,10 @@ public class ModFilesystem { Path relativePath = (path.isAbsolute() ? this.sourceDirectory.relativize(path) : path).normalize(); - if (Meows.getPaths().isRestricted(relativePath)) { + if (relativePath.startsWith("..") || Meows.getPaths().isRestricted(relativePath)) { throw new RuntimeException("Path \"%s\" is restricted and cannot be modified".formatted(relativePath)); } - // todo: validation (remain in source directory, might already be solved by RegularFile) - return relativePath; } }