mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 15:38:57 +01:00
s3: fix crash if a bad listing is received - fixes #1927
Caringo Swarm is returning a listing with IsTruncated set but no NextMarker and no Keys. Rclone doesn't know how to continue the listing at this point, so it returns an error rather than truncating the listing or risking a loop.
This commit is contained in:
parent
0d4bff8239
commit
255d3e925d
3
s3/s3.go
3
s3/s3.go
@ -554,6 +554,9 @@ func (f *Fs) list(dir string, recurse bool, fn listFn) error {
|
||||
}
|
||||
// Use NextMarker if set, otherwise use last Key
|
||||
if resp.NextMarker == nil || *resp.NextMarker == "" {
|
||||
if len(resp.Contents) == 0 {
|
||||
return errors.New("s3 protocol error: received listing with IsTruncated set, no NextMarker and no Contents")
|
||||
}
|
||||
marker = resp.Contents[len(resp.Contents)-1].Key
|
||||
} else {
|
||||
marker = resp.NextMarker
|
||||
|
Loading…
Reference in New Issue
Block a user