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.
This commit is contained in:
Nick Craig-Wood 2017-01-15 12:18:07 +00:00
parent 1fa258c2b4
commit 0604d3dbf2
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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