Skip to content

Commit

Permalink
kvmetainfo: ensure that the UserDefined map is not nil (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbenten authored Mar 10, 2020
1 parent 106e647 commit 042c45b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions private/metainfo/kvmetainfo/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ func objectFromMeta(bucket storj.Bucket, path storj.Path, listItem storj.ObjectL
return storj.Object{}, err
}

// ensure that the map is not nil
if serializableMeta.UserDefined == nil {
serializableMeta.UserDefined = map[string]string{}
}

_, found := serializableMeta.UserDefined[contentTypeKey]
if !found && serializableMeta.ContentType != "" {
serializableMeta.UserDefined[contentTypeKey] = serializableMeta.ContentType
Expand Down

0 comments on commit 042c45b

Please sign in to comment.