netstorage,quatrix,seafile: fix Root to return correct directory when pointing to a file

This fixes the TestIntegration/FsMkdir/FsPutFiles/FsIsFile/FsRoot
integration test.
This commit is contained in:
Nick Craig-Wood
2024-03-07 12:35:26 +00:00
parent 5750795324
commit 339d3e8ee6
3 changed files with 16 additions and 0 deletions

View File

@@ -235,6 +235,11 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
if fileID.IsFile() {
root, _ = dircache.SplitPath(root)
f.dirCache = dircache.New(root, rootID.FileID, f)
// Correct root if definitely pointing to a file
f.root = path.Dir(f.root)
if f.root == "." || f.root == "/" {
f.root = ""
}
return f, fs.ErrorIsFile
}