Wire final import declarations through loading

This commit is contained in:
2026-10-19 20:50:47 +00:00
parent f5a689b578
commit 1e5bffc0e6
19 changed files with 305 additions and 357 deletions

View File

@@ -136,10 +136,16 @@ func resolveHostImportPath(access *filesystemAccess, name string) (string, error
if err != nil {
return "", err
}
var targetPath string
if filepath.IsAbs(target) {
return "", errImportPathOutsideRoot
relative, err := filepath.Rel(access.rootPath, filepath.Clean(target))
if err != nil {
return "", errImportPathOutsideRoot
}
targetPath = path.Clean(filepath.ToSlash(relative))
} else {
targetPath = path.Clean(path.Join(path.Dir(candidate), filepath.ToSlash(target)))
}
targetPath := path.Clean(path.Join(path.Dir(candidate), filepath.ToSlash(target)))
if !withinPortableRoot(targetPath) {
return "", errImportPathOutsideRoot
}