mirror of
https://github.com/rclone/rclone.git
synced 2025-08-14 07:49:00 +02:00
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:
@ -15,6 +15,7 @@ import (
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -260,6 +261,11 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
case fs.ErrorObjectNotFound:
|
||||
return f, nil
|
||||
case fs.ErrorIsFile:
|
||||
// Correct root if definitely pointing to a file
|
||||
f.root = path.Dir(f.root)
|
||||
if f.root == "." || f.root == "/" {
|
||||
f.root = ""
|
||||
}
|
||||
// Fs points to the parent directory
|
||||
return f, err
|
||||
default:
|
||||
|
Reference in New Issue
Block a user