yandex: fix listing/deleting files in the root - fixes #2471

Before this change `rclone ls yandex:hello.txt` would fail whereas
`rclone ls yandex:/hello.txt` would succeed.  Now they both succeed.
This commit is contained in:
Nick Craig-Wood 2018-08-18 12:12:19 +01:00
parent 6c5ccf26b1
commit 41f709e13b
1 changed files with 5 additions and 1 deletions

View File

@ -165,7 +165,11 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
//return err
} else {
if ResourceInfoResponse.ResourceType == "file" {
f.setRoot(path.Dir(root))
rootDir := path.Dir(root)
if rootDir == "." {
rootDir = ""
}
f.setRoot(rootDir)
// return an error with an fs which points to the parent
return f, fs.ErrorIsFile
}