From 0604d3dbf255184320878a9a0bba2300dbc5c624 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 15 Jan 2017 12:18:07 +0000 Subject: [PATCH] acd, onedrive: make sure we have found the root before purging If we don't, purge can try to trash the root node which fortunately doesn't succeed. --- amazonclouddrive/amazonclouddrive.go | 4 ++++ onedrive/onedrive.go | 4 ++++ 2 files changed, 8 insertions(+) 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