From 6baf45e36083a26b128be227ef3d85bd0b723d66 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 15 Jul 2015 10:04:15 -0700 Subject: [PATCH] Fix a crash during listObjects() populating NextMarker --- pkg/donut/donut-v2.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/donut/donut-v2.go b/pkg/donut/donut-v2.go index c0a1e83f9..944967fb7 100644 --- a/pkg/donut/donut-v2.go +++ b/pkg/donut/donut-v2.go @@ -545,9 +545,6 @@ func (donut API) ListObjects(bucket string, resources BucketResourcesMetadata, s } resources.CommonPrefixes = listObjects.CommonPrefixes resources.IsTruncated = listObjects.IsTruncated - if resources.IsTruncated && resources.Delimiter != "" { - resources.NextMarker = results[len(results)-1].Object - } for key := range listObjects.Objects { keys = append(keys, key) } @@ -555,6 +552,9 @@ func (donut API) ListObjects(bucket string, resources BucketResourcesMetadata, s for _, key := range keys { results = append(results, listObjects.Objects[key]) } + if resources.IsTruncated && resources.Delimiter != "" { + resources.NextMarker = results[len(results)-1].Object + } return results, resources, nil } storedBucket := donut.storedBuckets.Get(bucket).(storedBucket)