mirror of
https://github.com/pgsty/minio.git
synced 2026-07-21 05:00:22 +03:00
Do not guess content-type for objects with no extension (#1918)
This commit is contained in:
committed by
Harshavardhana
parent
129ebbd685
commit
f51d34cedd
@@ -225,13 +225,15 @@ func (fs fsObjects) GetObjectInfo(bucket, object string) (ObjectInfo, error) {
|
||||
if err != nil {
|
||||
return ObjectInfo{}, toObjectErr(err, bucket, object)
|
||||
}
|
||||
contentType := "application/octet-stream"
|
||||
|
||||
// Guess content-type from the extension if possible.
|
||||
contentType := ""
|
||||
if objectExt := filepath.Ext(object); objectExt != "" {
|
||||
content, ok := mimedb.DB[strings.ToLower(strings.TrimPrefix(objectExt, "."))]
|
||||
if ok {
|
||||
if content, ok := mimedb.DB[strings.ToLower(strings.TrimPrefix(objectExt, "."))]; ok {
|
||||
contentType = content.ContentType
|
||||
}
|
||||
}
|
||||
|
||||
return ObjectInfo{
|
||||
Bucket: bucket,
|
||||
Name: object,
|
||||
|
||||
Reference in New Issue
Block a user