From c3e2392f2bd8728091010c686d93653dc6a4ccfa Mon Sep 17 00:00:00 2001 From: Robert Thomas <31854736+wolveix@users.noreply.github.com> Date: Fri, 5 Mar 2021 17:44:47 +0000 Subject: [PATCH] dropbox: fix polling support for scoped apps - fixes #5089 (#5092) This fixes the polling implementation for Dropbox, particularly when using a scoped app. This also adds a lower end check for the timeout, as I forgot to include that in the original implementation. --- backend/dropbox/dropbox.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.go index 31008ae76..406cb0677 100755 --- a/backend/dropbox/dropbox.go +++ b/backend/dropbox/dropbox.go @@ -1255,7 +1255,17 @@ func (f *Fs) changeNotifyCursor() (cursor string, err error) { var startCursor *files.ListFolderGetLatestCursorResult err = f.pacer.Call(func() (bool, error) { - startCursor, err = f.srv.ListFolderGetLatestCursor(&files.ListFolderArg{Path: f.opt.Enc.FromStandardPath(f.slashRoot), Recursive: true}) + arg := files.ListFolderArg{ + Path: f.opt.Enc.FromStandardPath(f.slashRoot), + Recursive: true, + } + + if arg.Path == "/" { + arg.Path = "" + } + + startCursor, err = f.srv.ListFolderGetLatestCursor(&arg) + return shouldRetry(err) }) if err != nil { @@ -1270,6 +1280,11 @@ func (f *Fs) changeNotifyRunner(ctx context.Context, notifyFunc func(string, fs. // Dropbox sets a timeout range of 30 - 480 timeout := uint64(f.ci.TimeoutOrInfinite() / time.Second) + + if timeout < 30 { + timeout = 30 + } + if timeout > 480 { timeout = 480 }