From 2bbfcc74e9b07cf0e85b16ef6c95f56dd660a0fa Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 21 Oct 2019 10:14:55 +0100 Subject: [PATCH] drive: fix --drive-shared-with-me from the root with ls and --fast-list When we changed recursive lists to use --fast-list by default this broke listing with --drive-shared-with-me from the root. This turned out to be an unwarranted assumption in the ListR code that all items would have a parent folder that we had searched for - this isn't true for shared with me items. This was fixed when using --drive-shared-with-me to give items that didn't have any parents a synthetic parent. Fixes #3639 --- backend/drive/drive.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index a933e124e..00f17e2fc 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -1515,6 +1515,10 @@ func (f *Fs) listRRunner(ctx context.Context, wg *sync.WaitGroup, in <-chan list listRSlices{dirs, paths}.Sort() var iErr error _, err := f.list(ctx, dirs, "", false, false, false, func(item *drive.File) bool { + // shared with me items have no parents when at the root + if f.opt.SharedWithMe && len(item.Parents) == 0 && len(paths) == 1 && paths[0] == "" { + item.Parents = dirs + } for _, parent := range item.Parents { // only handle parents that are in the requested dirs list i := sort.SearchStrings(dirs, parent)