mirror of
https://github.com/minio/minio.git
synced 2026-11-24 15:19:55 +00:00
Do not guess content-type for objects with no extension (#1918)
This commit is contained in:
1 parent
129ebbd685
commit
f51d34cedd
4 files changed
+24
-25
No files matched your search
@@ -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