mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-8703: Fixed issue when listing directory on S3, it would only return objectSummaries when the anwser from the S3 System was truncated.
This commit is contained in:
parent
c5ebb68be4
commit
5f87e9c917
@ -352,10 +352,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