mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-17 02:53:18 +01:00
#651 (@borisroman) CLOUDSTACK-8703: Fixed issue when listing direct..
* pr/651: CLOUDSTACK-8703: Fixed issue when listing directory on S3, it would only return objectSummaries when the anwser from the S3 System was truncated. Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
commit
7b47c49bb0
@ -354,10 +354,15 @@ public final class S3Utils {
|
||||
ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucketName).withPrefix(directory + SEPARATOR);
|
||||
|
||||
ObjectListing ol = client.listObjects(listObjectsRequest);
|
||||
while (ol != null && ol.isTruncated()) {
|
||||
if(ol.isTruncated()) {
|
||||
do {
|
||||
objects.addAll(ol.getObjectSummaries());
|
||||
listObjectsRequest.setMarker(ol.getNextMarker());
|
||||
ol = client.listObjects(listObjectsRequest);
|
||||
} while (ol.isTruncated());
|
||||
}
|
||||
else {
|
||||
objects.addAll(ol.getObjectSummaries());
|
||||
listObjectsRequest.setMarker(ol.getNextMarker());
|
||||
ol = client.listObjects(listObjectsRequest);
|
||||
}
|
||||
|
||||
if (objects.isEmpty()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user