From c1307103b2b0c874a017353cd85812f862f5dcfc Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 16 May 2014 01:10:46 -0700 Subject: [PATCH] fix orientation for all jpg files --- go/storage/needle.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/go/storage/needle.go b/go/storage/needle.go index b29a88159..77aa70169 100644 --- a/go/storage/needle.go +++ b/go/storage/needle.go @@ -117,8 +117,11 @@ func NewNeedle(r *http.Request, fixJpgOrientation bool) (n *Needle, e error) { } n.SetHasLastModifiedDate() - if fixJpgOrientation && strings.HasSuffix(strings.ToLower(string(n.Name)), ".jpg") { - n.Data = images.FixJpgOrientation(n.Data) + if fixJpgOrientation { + loweredName := strings.ToLower(fname) + if mimeType == "image/jpeg" || strings.HasSuffix(loweredName, ".jpg") || strings.HasSuffix(loweredName, ".jpeg") { + n.Data = images.FixJpgOrientation(n.Data) + } } n.Checksum = NewCRC(n.Data)