Browse code

Merge pull request #925 from jmaitrehenry/marker

Change the marker value for NextMarker in bucket_list_streaming

Florent Viard authored on 2017/10/12 06:32:51
Showing 1 changed files
... ...
@@ -328,6 +328,9 @@ class S3(object):
328 328
         def _get_common_prefixes(data):
329 329
             return getListFromXml(data, "CommonPrefixes")
330 330
 
331
+        def _get_next_marker(data, current_list):
332
+            return getTextFromXml(response["data"], "NextMarker") or current_list[-1]["Key"]
333
+
331 334
         uri_params = uri_params and uri_params.copy() or {}
332 335
         truncated = True
333 336
         prefixes = []
... ...
@@ -347,7 +350,7 @@ class S3(object):
347 347
             if truncated:
348 348
                 if limit == -1 or num_objects + num_prefixes < limit:
349 349
                     if current_list:
350
-                        uri_params['marker'] = current_list[-1]["Key"]
350
+                        uri_params['marker'] = _get_next_marker(response["data"], current_list)
351 351
                     else:
352 352
                         uri_params['marker'] = current_prefixes[-1]["Prefix"]
353 353
                     debug("Listing continues after '%s'" % uri_params['marker'])