refactor: Rewrite path sanitizer to support write operations on relative tar archives

This commit is contained in:
Felicitas Pojtinger
2022-01-04 22:20:33 +01:00
parent 1298147b89
commit 4b246f2794
3 changed files with 129 additions and 96 deletions

View File

@@ -2,6 +2,7 @@ package fs
import (
"archive/tar"
"context"
"database/sql"
"io"
"os"
@@ -70,6 +71,9 @@ func (f *STFS) Name() string {
"name": config.FileSystemNameSTFS,
})
f.ioLock.Lock()
defer f.ioLock.Unlock()
return config.FileSystemNameSTFS
}
@@ -170,7 +174,16 @@ func (f *STFS) MkdirRoot(name string, perm os.FileMode) error {
f.ioLock.Lock()
defer f.ioLock.Unlock()
return f.mknodeWithoutLocking(true, name, perm, true, "")
if err := f.mknodeWithoutLocking(true, name, perm, true, ""); err != nil {
return err
}
// Ensure that the new root path is being used
if _, err := f.metadata.Metadata.GetRootPath(context.Background()); err != nil {
return err
}
return nil
}
func (f *STFS) Mkdir(name string, perm os.FileMode) error {