Simplify pkg mimedb (#6549)

Content-Type resolution can now use a function `TypeByExtension(extension)` 
to resolve to the respective content-type.
This commit is contained in:
Praveen raj Mani
2018-10-02 11:48:17 +05:30
committed by Nitish Tiwari
parent f163bed40d
commit c7722fbb1b
6 changed files with 54 additions and 34 deletions
+1 -8
View File
@@ -198,15 +198,8 @@ func (xl xlObjects) newMultipartUpload(ctx context.Context, bucket string, objec
// establish the writeQuorum using this data
writeQuorum := dataBlocks + 1
// If not set default to "application/octet-stream"
if meta["content-type"] == "" {
contentType := "application/octet-stream"
if objectExt := path.Ext(object); objectExt != "" {
content, ok := mimedb.DB[strings.ToLower(strings.TrimPrefix(objectExt, "."))]
if ok {
contentType = content.ContentType
}
}
contentType := mimedb.TypeByExtension(path.Ext(object))
meta["content-type"] = contentType
}
xlMeta.Stat.ModTime = UTCNow()