From 81fcbd2a54735031beea2be8613185482d7ec13b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 2 Feb 2016 17:54:57 -0800 Subject: [PATCH] statObject: Make sure to lowercase file extensions. --- pkg/fs/fs-multipart.go | 2 +- pkg/fs/fs-object.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/fs/fs-multipart.go b/pkg/fs/fs-multipart.go index 1ee6c4754..37a6a262f 100644 --- a/pkg/fs/fs-multipart.go +++ b/pkg/fs/fs-multipart.go @@ -435,7 +435,7 @@ func (fs Filesystem) CompleteMultipartUpload(bucket, object, uploadID string, da } contentType := "application/octet-stream" if objectExt := filepath.Ext(objectPath); objectExt != "" { - contentType = contentdb.MustLookup(strings.TrimPrefix(objectExt, ".")) + contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, "."))) } newObject := ObjectMetadata{ Bucket: bucket, diff --git a/pkg/fs/fs-object.go b/pkg/fs/fs-object.go index b4b14bf44..471a218cf 100644 --- a/pkg/fs/fs-object.go +++ b/pkg/fs/fs-object.go @@ -155,7 +155,7 @@ func getMetadata(rootPath, bucket, object string) (ObjectMetadata, *probe.Error) object = sanitizeWindowsPath(object) } if objectExt := filepath.Ext(object); objectExt != "" { - contentType = contentdb.MustLookup(strings.TrimPrefix(objectExt, ".")) + contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, "."))) } metadata := ObjectMetadata{ Bucket: bucket, @@ -285,7 +285,7 @@ func (fs Filesystem) CreateObject(bucket, object, expectedMD5Sum string, size in } contentType := "application/octet-stream" if objectExt := filepath.Ext(objectPath); objectExt != "" { - contentType = contentdb.MustLookup(strings.TrimPrefix(objectExt, ".")) + contentType = contentdb.MustLookup(strings.ToLower(strings.TrimPrefix(objectExt, "."))) } newObject := ObjectMetadata{ Bucket: bucket,