From f8c2689e77a8406e91f4811ffa6acb933047f242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=B6ller?= Date: Thu, 7 Feb 2019 16:18:52 +0100 Subject: [PATCH] drive: improve ChangeNotify support for items with multiple parents --- backend/drive/drive.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index c3c1a35d7..8259b4ecc 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -2199,11 +2199,13 @@ func (f *Fs) changeNotifyRunner(notifyFunc func(string, fs.EntryType), startPage // translate the parent dir of this object if len(change.File.Parents) > 0 { - if parentPath, ok := f.dirCache.GetInv(change.File.Parents[0]); ok { - // and append the drive file name to compute the full file name - newPath := path.Join(parentPath, change.File.Name) - // this will now clear the actual file too - pathsToClear = append(pathsToClear, entryType{path: newPath, entryType: changeType}) + for _, parent := range change.File.Parents { + if parentPath, ok := f.dirCache.GetInv(parent); ok { + // and append the drive file name to compute the full file name + newPath := path.Join(parentPath, change.File.Name) + // this will now clear the actual file too + pathsToClear = append(pathsToClear, entryType{path: newPath, entryType: changeType}) + } } } else { // a true root object that is changed pathsToClear = append(pathsToClear, entryType{path: change.File.Name, entryType: changeType})