feat: Add OsFs-compliant support for Readlink, Symlink and Lstat

This commit is contained in:
Felicitas Pojtinger
2022-01-16 18:03:43 +01:00
parent f2c6c65a53
commit 2a28fa3b5f
6 changed files with 229 additions and 153 deletions

View File

@@ -20,6 +20,7 @@ func Stat(
onHeader func(hdr *config.Header),
) (*tar.Header, error) {
name = filepath.ToSlash(name)
linkname := filepath.ToSlash(name)
if symlink {
// Resolve symlink
@@ -36,6 +37,7 @@ func Stat(
}
name = link.Name
linkname = link.Linkname
}
dbhdr, err := metadata.Metadata.GetHeader(context.Background(), name)
@@ -49,6 +51,10 @@ func Stat(
return nil, err
}
}
if symlink {
dbhdr.Name = linkname
dbhdr.Linkname = name
}
hdr, err := converters.DBHeaderToTarHeader(converters.ConfigHeaderToDBHeader(dbhdr))
if err != nil {