Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

s3: detect looping when using gcs and versions

Nick Craig-Woodba11040d6b53
diff --git a/backend/s3/s3.go b/backend/s3/s3.go
index d4f686735..bb4e97c61 100644
--- a/backend/s3/s3.go
+++ b/backend/s3/s3.go
@@ -3721,6 +3721,9 @@ func (ls *versionsList) List(ctx context.Context) (resp *s3.ListObjectsV2Output,
// Set up the request for next time
ls.req.KeyMarker = respVersions.NextKeyMarker
ls.req.VersionIdMarker = respVersions.NextVersionIdMarker
+ if aws.BoolValue(respVersions.IsTruncated) && ls.req.KeyMarker == nil {
+ return nil, nil, errors.New("s3 protocol error: received versions listing with IsTruncated set with no NextKeyMarker")
+ }
// If we are URL encoding then must decode the marker
if ls.req.KeyMarker != nil && ls.req.EncodingType != nil {
diff --git a/docs/content/s3.md b/docs/content/s3.md
index b1853b3e6..b4bdf10f8 100644
--- a/docs/content/s3.md
+++ b/docs/content/s3.md
@@ -3685,6 +3685,12 @@ secret_access_key = your_secret_key
endpoint = https://storage.googleapis.com
```
+**Note** that `--s3-versions` does not work with GCS when it needs to do directory paging. Rclone will return the error:
+
+ s3 protocol error: received versions listing with IsTruncated set with no NextKeyMarker
+
+This is Google bug [#312292516](https://issuetracker.google.com/u/0/issues/312292516).
+
### DigitalOcean Spaces
[Spaces](https://www.digitalocean.com/products/object-storage/) is an [S3-interoperable](https://developers.digitalocean.com/documentation/spaces/) object storage service from cloud provider DigitalOcean.