Skip to content

Commit 228fdf8

Browse files
committed
NPE
Signed-off-by: Daniel Valdivia <[email protected]>
1 parent 333bb98 commit 228fdf8

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

restapi/user_buckets.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -308,20 +308,16 @@ func getAccountInfo(ctx context.Context, client MinioAdmin) ([]*models.Bucket, e
308308
var bucketInfos []*models.Bucket
309309
for _, bucket := range info.Buckets {
310310

311-
var tags map[string]string
311+
tags := make(map[string]string)
312312
if bucket.Details != nil && bucket.Details.Tagging != nil {
313313
tags = bucket.Details.Tagging.ToMap()
314314
}
315315

316316
bucketElem := &models.Bucket{
317317
CreationDate: bucket.Created.Format(time.RFC3339),
318318
Details: &models.BucketDetails{
319-
Locking: bucket.Details.Locking,
320-
Quota: nil,
321-
Replication: bucket.Details.Replication,
322-
Tags: tags,
323-
Versioning: bucket.Details.Versioning,
324-
VersioningSuspended: bucket.Details.VersioningSuspended,
319+
Quota: nil,
320+
Tags: tags,
325321
},
326322
RwAccess: &models.BucketRwAccess{
327323
Read: bucket.Access.Read,
@@ -331,12 +327,20 @@ func getAccountInfo(ctx context.Context, client MinioAdmin) ([]*models.Bucket, e
331327
Objects: int64(bucket.Objects),
332328
Size: int64(bucket.Size),
333329
}
334-
if bucket.Details != nil && bucket.Details.Quota != nil {
335-
bucketElem.Details.Quota = &models.BucketDetailsQuota{
336-
Quota: int64(bucket.Details.Quota.Quota),
337-
Type: string(bucket.Details.Quota.Type),
330+
331+
if bucket.Details != nil {
332+
bucketElem.Details.Locking = bucket.Details.Locking
333+
bucketElem.Details.Replication = bucket.Details.Replication
334+
bucketElem.Details.Versioning = bucket.Details.Versioning
335+
bucketElem.Details.VersioningSuspended = bucket.Details.VersioningSuspended
336+
if bucket.Details.Quota != nil {
337+
bucketElem.Details.Quota = &models.BucketDetailsQuota{
338+
Quota: int64(bucket.Details.Quota.Quota),
339+
Type: string(bucket.Details.Quota.Type),
340+
}
338341
}
339342
}
343+
340344
bucketInfos = append(bucketInfos, bucketElem)
341345
}
342346
return bucketInfos, nil

0 commit comments

Comments
 (0)