From 2243b065e8d0949d7b6dd0cc766a3b17c5c60639 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sun, 6 Nov 2016 17:07:11 +0100 Subject: [PATCH] acd: filter out bogus children Amazon reports sometimes --- amazonclouddrive/amazonclouddrive.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.go index 1e46c3343..94d597f7b 100644 --- a/amazonclouddrive/amazonclouddrive.go +++ b/amazonclouddrive/amazonclouddrive.go @@ -392,6 +392,17 @@ func (f *Fs) listAll(dirID string, title string, directoriesOnly bool, filesOnly if *node.Status != statusAvailable { continue } + // Ignore bogus nodes Amazon Drive sometimes reports + hasValidParent := false + for _, parent := range node.Parents { + if parent == dirID { + hasValidParent = true + break + } + } + if !hasValidParent { + continue + } // Store the nodes up in case we have to retry the listing out = append(out, node) }