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

drive: fix ChangeNotify for folders

Fabian Möller3b5e70c8c669
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})
}
}
}