From 254e5143305cf4e948831857227b463433ac4d32 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 15 Apr 2024 21:17:22 +0100 Subject: [PATCH] onedrive,drive: make errors setting permissions into no retry errors --- backend/drive/metadata.go | 7 ++++++- backend/onedrive/metadata.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/drive/metadata.go b/backend/drive/metadata.go index ee547eed0..879303b66 100644 --- a/backend/drive/metadata.go +++ b/backend/drive/metadata.go @@ -9,6 +9,7 @@ import ( "sync" "github.com/rclone/rclone/fs" + "github.com/rclone/rclone/fs/fserrors" "github.com/rclone/rclone/lib/errcount" "golang.org/x/sync/errgroup" drive "google.golang.org/api/drive/v3" @@ -155,7 +156,11 @@ func (f *Fs) setPermissions(ctx context.Context, info *drive.File, permissions [ errs.Add(err) } } - return errs.Err("failed to set permission") + err = errs.Err("failed to set permission") + if err != nil { + err = fserrors.NoRetryError(err) + } + return err } // Clean attributes from permissions which we can't write diff --git a/backend/onedrive/metadata.go b/backend/onedrive/metadata.go index 30fad0359..55aa752e4 100644 --- a/backend/onedrive/metadata.go +++ b/backend/onedrive/metadata.go @@ -11,6 +11,7 @@ import ( "github.com/rclone/rclone/backend/onedrive/api" "github.com/rclone/rclone/fs" + "github.com/rclone/rclone/fs/fserrors" "github.com/rclone/rclone/lib/dircache" "github.com/rclone/rclone/lib/errcount" "golang.org/x/exp/slices" // replace with slices after go1.21 is the minimum version @@ -462,7 +463,11 @@ func (m *Metadata) processPermissions(ctx context.Context, add, update, remove [ newPermissions = append(newPermissions, newP) } - return newPermissions, errs.Err("failed to set permissions") + err = errs.Err("failed to set permissions") + if err != nil { + err = fserrors.NoRetryError(err) + } + return newPermissions, err } // fillRecipients looks for recipients to add from the permission passed in.