From db37b3ef9e238741d829174ead82f3a28fcafbf4 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 5 Sep 2023 17:59:03 +0100 Subject: [PATCH] opendrive: fix List on a just deleted and remade directory Sometimes opendrive reports "403 Folder is already deleted" on directories which should exist. This might be a bug in opendrive or in rclone however we work-around here sufficient to get the tests passing. --- backend/opendrive/opendrive.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/opendrive/opendrive.go b/backend/opendrive/opendrive.go index 263daa223..0b0ee2e9d 100644 --- a/backend/opendrive/opendrive.go +++ b/backend/opendrive/opendrive.go @@ -767,6 +767,17 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e return f.shouldRetry(ctx, resp, err) }) if err != nil { + if apiError, ok := err.(*Error); ok { + // Work around a bug maybe in opendrive or maybe in rclone. + // + // We should know whether the folder exists or not by the call to + // FindDir above so exactly why it is not found here is a mystery. + // + // This manifests as a failure in fs/sync TestSyncOverlapWithFilter + if apiError.Info.Message == "Folder is already deleted" { + return fs.DirEntries{}, nil + } + } return nil, fmt.Errorf("failed to get folder list: %w", err) }