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

acd, onedrive: make sure we have found the root before purging

Nick Craig-Wood0604d3dbf255
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.go
index 48b6eec4d..aadce1670 100644
--- a/amazonclouddrive/amazonclouddrive.go
+++ b/amazonclouddrive/amazonclouddrive.go
@@ -753,6 +753,10 @@ func (f *Fs) purgeCheck(dir string, check bool) error {
return errors.New("can't purge root directory")
}
dc := f.dirCache
+ err := dc.FindRoot(false)
+ if err != nil {
+ return err
+ }
rootID, err := dc.FindDir(dir, false)
if err != nil {
return err
diff --git a/onedrive/onedrive.go b/onedrive/onedrive.go
index 459b68391..a8178138c 100644
--- a/onedrive/onedrive.go
+++ b/onedrive/onedrive.go
@@ -491,6 +491,10 @@ func (f *Fs) purgeCheck(dir string, check bool) error {
return errors.New("can't purge root directory")
}
dc := f.dirCache
+ err := dc.FindRoot(false)
+ if err != nil {
+ return err
+ }
rootID, err := dc.FindDir(dir, false)
if err != nil {
return err