mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 17:57:44 +08:00
drive: improve directory notifications in ChangeNotify
When moving a directory in drive, most of the time only a notification for the directory itself is created, not the old or new parents. This tires to find the old path in the dirCache and the new path with the dirCache of the new parent, which can result in two notifications for a moved directory.
This commit is contained in:
parent
59e14c25df
commit
05fa9cb379
|
@ -2061,15 +2061,16 @@ func (f *Fs) changeNotifyRunner(notifyFunc func(string, fs.EntryType), startPage
|
|||
}
|
||||
var pathsToClear []entryType
|
||||
for _, change := range changeList.Changes {
|
||||
// find the previous path
|
||||
if path, ok := f.dirCache.GetInv(change.FileId); ok {
|
||||
if change.File != nil && change.File.MimeType != driveFolderType {
|
||||
pathsToClear = append(pathsToClear, entryType{path: path, entryType: fs.EntryObject})
|
||||
} else {
|
||||
pathsToClear = append(pathsToClear, entryType{path: path, entryType: fs.EntryDirectory})
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// find the new path
|
||||
if change.File != nil {
|
||||
changeType := fs.EntryDirectory
|
||||
if change.File.MimeType != driveFolderType {
|
||||
|
|
Loading…
Reference in New Issue
Block a user