Skip to content

Commit

Permalink
Merge pull request #746 from versity/ben/list_buckets
Browse files Browse the repository at this point in the history
fix: allow listing buckets without acl attribute
  • Loading branch information
benmcclelland authored Aug 22, 2024
2 parents 72ad820 + 2942b16 commit 8f89d32
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions backend/posix/posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ func (p *Posix) ListBuckets(_ context.Context, owner string, isAdmin bool) (s3re
}

aclTag, err := p.meta.RetrieveAttribute(entry.Name(), "", aclkey)
if errors.Is(err, meta.ErrNoSuchKey) {
// skip buckets without acl tag
continue
}
if err != nil {
return s3response.ListAllMyBucketsResult{}, fmt.Errorf("get acl tag: %w", err)
}
Expand Down Expand Up @@ -2681,14 +2685,16 @@ func (p *Posix) ListBucketsAndOwners(ctx context.Context) (buckets []s3response.
}

aclTag, err := p.meta.RetrieveAttribute(entry.Name(), "", aclkey)
if err != nil {
if err != nil && !errors.Is(err, meta.ErrNoSuchKey) {
return buckets, fmt.Errorf("get acl tag: %w", err)
}

var acl auth.ACL
err = json.Unmarshal(aclTag, &acl)
if err != nil {
return buckets, fmt.Errorf("parse acl tag: %w", err)
if len(aclTag) > 0 {
err = json.Unmarshal(aclTag, &acl)
if err != nil {
return buckets, fmt.Errorf("parse acl tag: %w", err)
}
}

buckets = append(buckets, s3response.Bucket{
Expand Down

0 comments on commit 8f89d32

Please sign in to comment.