Skip to content

Commit

Permalink
Read content type from JSON map if it exist
Browse files Browse the repository at this point in the history
  • Loading branch information
rickmak committed Mar 28, 2017
1 parent f527b7d commit a229f55
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/server/skydb/skyconv/map.go
Expand Up @@ -122,8 +122,17 @@ func (asset *MapAsset) FromMap(m map[string]interface{}) error {
if name == "" {
return errors.New("asset's $name should not be empty")
}

asset.Name = name

contentTypei, ok := m["$content_type"]
if ok {
contentType, ok := contentTypei.(string)
if !ok {
return fmt.Errorf("got type($contentType) = %T, want string", contentTypei)
}
asset.ContentType = contentType
}

return nil
}

Expand Down

0 comments on commit a229f55

Please sign in to comment.