Fix resolving non existant files in the root directory

This commit is contained in:
Linnea Gräf 2024-07-22 15:00:05 +02:00
parent 7c76b5ca1a
commit 508676d9bd
No known key found for this signature in database
GPG key ID: AA563E93EB628D91

View file

@ -76,7 +76,6 @@ public class JsVm {
for (int i = 0; i < splitPath.size(); i++) {
var segment = splitPath.get(i);
var child = node.listing().get(segment);
if (child == null) return null;
if (child instanceof AjarSymlinkFile symlink) {
// TODO: symlink infinite recursion protection
if (symlink.target().startsWith("/")) {
@ -86,6 +85,7 @@ public class JsVm {
}
}
if (i == splitPath.size() - 1) break;
if (child == null) return null;
if (!(child instanceof AjarDirectory directory)) {
throw new RuntimeException("No such file or directory " + path);
}