Skip to content

Commit

Permalink
[Issue #121]: fix listing objects. (#123)
Browse files Browse the repository at this point in the history
Support listing more than 1000 object in a bucket.
  • Loading branch information
bianhq authored Oct 8, 2021
1 parent dde1be5 commit 8f058f4
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,15 @@ public List<Status> listStatus(String path) throws IOException
ListObjectsV2Request request = ListObjectsV2Request.builder()
.bucket(p.bucket).build();
ListObjectsV2Response response = s3.listObjectsV2(request);
List<S3Object> objects = response.contents();
List<S3Object> objects = new ArrayList<>(response.keyCount());
while (response.isTruncated())
{
objects.addAll(response.contents());
request = ListObjectsV2Request.builder().bucket(p.bucket)
.continuationToken(response.nextContinuationToken()).build();
response = s3.listObjectsV2(request);
}
objects.addAll(response.contents());
List<Status> statuses = new ArrayList<>();
Path op = new Path(path);
op.isBucket = false;
Expand Down

0 comments on commit 8f058f4

Please sign in to comment.