Skip to content

Commit

Permalink
object/s3: fix nil when StorageClass is missing from List (#4183)
Browse files Browse the repository at this point in the history
  • Loading branch information
davies authored Nov 22, 2023
1 parent e7f9eb2 commit 996c34b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/object/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,9 @@ func (s *s3client) Head(key string) (Object, error) {
}
return nil, err
}
var sc string
var sc = "STANDARD"
if r.StorageClass != nil {
sc = *r.StorageClass
} else {
sc = "STANDARD"
}
return &obj{
key,
Expand Down Expand Up @@ -228,12 +226,16 @@ func (s *s3client) List(prefix, marker, delimiter string, limit int64, followLin
if !strings.HasPrefix(oKey, prefix) || oKey < marker {
return nil, fmt.Errorf("found invalid key %s from List, prefix: %s, marker: %s", oKey, prefix, marker)
}
var sc = "STANDARD"
if o.StorageClass != nil {
sc = *o.StorageClass
}
objs[i] = &obj{
oKey,
*o.Size,
*o.LastModified,
strings.HasSuffix(oKey, "/"),
*o.StorageClass,
sc,
}
}
if delimiter != "" {
Expand Down

0 comments on commit 996c34b

Please sign in to comment.