Resolve contained symlinks in import directory prefixes
This commit is contained in:
@@ -27,6 +27,16 @@ func (a *filesystemAccess) importEntryTarget(name string, entry fs.DirEntry, fol
|
||||
if err != nil {
|
||||
return importEntryTarget{}, err
|
||||
}
|
||||
// Root.Lstat cannot follow absolute links in intermediate components,
|
||||
// even when contained. Resolve parents first, leaving the final entry
|
||||
// unexpanded so its discovered-link follow policy still applies.
|
||||
if parent := filepath.Dir(relative); parent != "." {
|
||||
resolvedParent, err := resolveHostImportPath(a, parent)
|
||||
if err != nil {
|
||||
return importEntryTarget{}, err
|
||||
}
|
||||
relative = filepath.Join(filepath.FromSlash(resolvedParent), filepath.Base(relative))
|
||||
}
|
||||
info, err := a.root.Lstat(relative)
|
||||
if err != nil {
|
||||
return importEntryTarget{}, err
|
||||
|
||||
Reference in New Issue
Block a user