mirror of
https://github.com/pgsty/minio.git
synced 2026-10-07 10:15:58 +03:00
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:
committed by
Nitish Tiwari
parent
f163bed40d
commit
c7722fbb1b
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user