From 3b5e70c8c669e98eba63fbdc70b4adc10ba22d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=B6ller?= Date: Wed, 2 May 2018 15:12:47 +0200 Subject: [PATCH] drive: fix ChangeNotify for folders --- backend/drive/drive.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index b98bde6c0..27c227645 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -1327,7 +1327,12 @@ func (f *Fs) changeNotifyRunner(notifyFunc func(string, fs.EntryType), pollInter continue } - if change.File != nil && change.File.MimeType != driveFolderType { + if change.File != nil { + changeType := fs.EntryDirectory + if change.File.MimeType != driveFolderType { + changeType = fs.EntryObject + } + // translate the parent dir of this object if len(change.File.Parents) > 0 { if path, ok := f.dirCache.GetInv(change.File.Parents[0]); ok { @@ -1338,10 +1343,10 @@ func (f *Fs) changeNotifyRunner(notifyFunc func(string, fs.EntryType), pollInter path = change.File.Name } // this will now clear the actual file too - pathsToClear = append(pathsToClear, entryType{path: path, entryType: fs.EntryObject}) + pathsToClear = append(pathsToClear, entryType{path: path, entryType: changeType}) } } else { // a true root object that is changed - pathsToClear = append(pathsToClear, entryType{path: change.File.Name, entryType: fs.EntryObject}) + pathsToClear = append(pathsToClear, entryType{path: change.File.Name, entryType: changeType}) } } }