1
mirror of https://github.com/rclone/rclone synced 2024-11-23 00:06:55 +01:00

s3: fix listing loop when using v2 listing on v1 server

Before this change, rclone would enter a listing loop if it used v2
listing on a v1 server and the list exceeded 1000 items.

This change detects the problem and gives the user a helpful message.

Fixes #6600
This commit is contained in:
Nick Craig-Wood 2022-12-05 16:59:48 +00:00
parent 10aee3926a
commit ab849b3613

View File

@ -3195,6 +3195,9 @@ func (ls *v2List) List(ctx context.Context) (resp *s3.ListObjectsV2Output, versi
if err != nil {
return nil, nil, err
}
if aws.BoolValue(resp.IsTruncated) && (resp.ContinuationToken == nil || *resp.ContinuationToken == "") {
return nil, nil, errors.New("s3 protocol error: received listing v2 with IsTruncated set and no ContinuationToken. Should you be using `--s3-list-version 1`?")
}
ls.req.ContinuationToken = resp.NextContinuationToken
return resp, nil, nil
}