Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix orientation for all jpg files

Chris Luc1307103b2b0
diff --git a/go/storage/needle.go b/go/storage/needle.go
index b29a881590..77aa70169e 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)