From 0b74d2b26825184c0dcbc20678979fb3f3509fd6 Mon Sep 17 00:00:00 2001 From: zhijian Date: Tue, 5 Nov 2024 09:44:06 +0800 Subject: [PATCH] cmd/gateway: always set content type (#5275) --- pkg/gateway/gateway.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/gateway/gateway.go b/pkg/gateway/gateway.go index fc9b46582c90..d20e0d0709a1 100644 --- a/pkg/gateway/gateway.go +++ b/pkg/gateway/gateway.go @@ -689,10 +689,8 @@ func (n *jfsObjects) GetObjectInfo(ctx context.Context, bucket, object string, o etag, _ = n.fs.GetXattr(mctx, n.path(bucket, object), s3Etag) } size := fi.Size() - var contentType string if fi.IsDir() { size = 0 - contentType = "application/octet-stream" } // key1=value1&key2=value2 var tagStr []byte @@ -710,7 +708,7 @@ func (n *jfsObjects) GetObjectInfo(ctx context.Context, bucket, object string, o IsDir: fi.IsDir(), AccTime: fi.ModTime(), ETag: string(etag), - ContentType: contentType, + ContentType: utils.GuessMimeType(object), UserTags: string(tagStr), UserDefined: minio.CleanMetadata(opts.UserDefined), }, nil