statObject: Make sure to lowercase file extensions.

master
Harshavardhana 9 years ago
parent b01594ac33
commit 81fcbd2a54
  1. 2
      pkg/fs/fs-multipart.go
  2. 4
      pkg/fs/fs-object.go

@ -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,

@ -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,

Loading…
Cancel
Save