"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
acd: Work around spurious 403 errors
Nick Craig-Wood085677d51187
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.goindex f7c251851..a650de969 100644--- a/amazonclouddrive/amazonclouddrive.go+++ b/amazonclouddrive/amazonclouddrive.go@@ -142,10 +142,19 @@ var retryErrorCodes = []int{// shouldRetry returns a boolean as to whether this resp and err// deserve to be retried. It returns the err as a conveniencefunc (f *Fs) shouldRetry(resp *http.Response, err error) (bool, error) {- if resp != nil && resp.StatusCode == 401 {- f.ts.Invalidate()- fs.Log(f, "401 error received - invalidating token")- return true, err+ if resp != nil {+ if resp.StatusCode == 401 {+ f.ts.Invalidate()+ fs.Log(f, "401 error received - invalidating token")+ return true, err+ }+ // Work around receiving this error sporadically on authentication+ //+ // HTTP code 403: "403 Forbidden", reponse body: {"message":"Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. Authorization=Bearer"}+ if resp.StatusCode == 403 && strings.Contains(err.Error(), "Authorization header requires") {+ fs.Log(f, "403 \"Authorization header requires...\" error received - retry")+ return true, err+ }}return fs.ShouldRetry(err) || fs.ShouldRetryHTTP(resp, retryErrorCodes), err}