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

@@ -18,7 +18,7 @@ func NewCacheFilesystem(
) (afero.Fs, error) {
switch cacheType {
case config.FileSystemCacheTypeMemory:
if pathext.IsRoot(root) {
if pathext.IsRoot(root, false) {
return afero.NewCacheOnReadFs(base, afero.NewMemMapFs(), ttl), nil
}
@@ -32,13 +32,13 @@ func NewCacheFilesystem(
return nil, err
}
if pathext.IsRoot(root) {
if pathext.IsRoot(root, false) {
return afero.NewCacheOnReadFs(base, afero.NewBasePathFs(afero.NewOsFs(), cacheDir), ttl), nil
}
return afero.NewCacheOnReadFs(afero.NewBasePathFs(base, root), afero.NewBasePathFs(afero.NewOsFs(), cacheDir), ttl), nil
case config.NoneKey:
if pathext.IsRoot(root) {
if pathext.IsRoot(root, false) {
return base, nil
}