Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

yandex: correct error return for listing empty directory

Nick Craig-Woodfded4dbea2da
diff --git a/yandex/yandex.go b/yandex/yandex.go
index 861749125..099bd1403 100644
--- a/yandex/yandex.go
+++ b/yandex/yandex.go
@@ -187,6 +187,10 @@ func (f *Fs) listDir(dir string, fn listFn) (err error) {
for {
ResourceInfoResponse, err := f.yd.NewResourceInfoRequest(root, opt).Exec()
if err != nil {
+ yErr, ok := err.(yandex.DiskClientError)
+ if ok && yErr.Code == "DiskNotFoundError" {
+ return fs.ErrorDirNotFound
+ }
return err
}
itemsCount = uint32(len(ResourceInfoResponse.Embedded.Items))
@@ -246,6 +250,10 @@ func (f *Fs) list(dir string, fn listFn) error {
//send request
info, err := f.yd.NewFlatFileListRequest(opt).Exec()
if err != nil {
+ yErr, ok := err.(yandex.DiskClientError)
+ if ok && yErr.Code == "DiskNotFoundError" {
+ return fs.ErrorDirNotFound
+ }
return err
}
itemsCount = uint32(len(info.Items))