Skip to content

Commit 3e635ab

Browse files
committed
fix get_bucket() if there are more than 1000 entries (closes #414)
1 parent 7debfa6 commit 3e635ab

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
* Adapt to `DisplayName` being removed from the AWS API (#437)
2828

29+
* `get_bucket` fetched incorrect list (repeating the first
30+
chunk) if multiple fetches were required and the response included
31+
the `NextMarker` entry (#414)
32+
2933

3034
# aws.s3 0.3.21
3135

R/get_bucket.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ get_bucket <- function(bucket,
5353
prefix = prefix,
5454
delimiter = delimiter,
5555
"max-keys" = as.integer(pmin(max - as.integer(r[["MaxKeys"]]), 1000)),
56-
marker = tail(r, 1)[["Contents"]][["Key"]]
56+
marker = if (!is.null(r[["NextMarker"]])) r[["NextMarker"]] else tail(r[names(r) == "Contents"], 1)[["Contents"]][["Key"]]
5757
)
5858
extra <- s3HTTP(verb = "GET", bucket = bucket, query = query, parse_response = parse_response, ...)
5959
new_r <- c(r, tail(extra, -5))

0 commit comments

Comments
 (0)