Merge pull request #1075 from harshavardhana/content-type

statObject: Make sure to lowercase file extensions.
This commit is contained in:
Harshavardhana 2016-02-02 18:02:59 -08:00
commit e39b6caada
2 changed files with 3 additions and 3 deletions

View File

@ -435,7 +435,7 @@ func (fs Filesystem) CompleteMultipartUpload(bucket, object, uploadID string, da
} }
contentType := "application/octet-stream" contentType := "application/octet-stream"
if objectExt := filepath.Ext(objectPath); objectExt != "" { if objectExt := filepath.Ext(objectPath); objectExt != "" {
contentType = contentdb.MustLookup(strings.TrimPrefix(objectExt, ".")) contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, ".")))
} }
newObject := ObjectMetadata{ newObject := ObjectMetadata{
Bucket: bucket, Bucket: bucket,

View File

@ -155,7 +155,7 @@ func getMetadata(rootPath, bucket, object string) (ObjectMetadata, *probe.Error)
object = sanitizeWindowsPath(object) object = sanitizeWindowsPath(object)
} }
if objectExt := filepath.Ext(object); objectExt != "" { if objectExt := filepath.Ext(object); objectExt != "" {
contentType = contentdb.MustLookup(strings.TrimPrefix(objectExt, ".")) contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, ".")))
} }
metadata := ObjectMetadata{ metadata := ObjectMetadata{
Bucket: bucket, Bucket: bucket,
@ -285,7 +285,7 @@ func (fs Filesystem) CreateObject(bucket, object, expectedMD5Sum string, size in
} }
contentType := "application/octet-stream" contentType := "application/octet-stream"
if objectExt := filepath.Ext(objectPath); objectExt != "" { if objectExt := filepath.Ext(objectPath); objectExt != "" {
contentType = contentdb.MustLookup(strings.TrimPrefix(objectExt, ".")) contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, ".")))
} }
newObject := ObjectMetadata{ newObject := ObjectMetadata{
Bucket: bucket, Bucket: bucket,