From 396e3c326baf7e68499332d28dcf24b76566baaa Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 27 May 2026 12:21:27 -0700 Subject: [PATCH] fix(remote_storage/gcs): forward entry mime as ContentType (#9711) fix(remote_storage/gcs): forward entry.Attributes.Mime as ContentType Same gap as the S3 client: filer.remote.sync to GCS never populated the object's ContentType, so HTML/CSS/etc. ended up stored as the GCS default and didn't render correctly in browsers. Mirrors the existing Azure client behavior (weed/remote_storage/azure/azure_storage_client.go). --- weed/remote_storage/gcs/gcs_storage_client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weed/remote_storage/gcs/gcs_storage_client.go b/weed/remote_storage/gcs/gcs_storage_client.go index 01053033e..69831aee5 100644 --- a/weed/remote_storage/gcs/gcs_storage_client.go +++ b/weed/remote_storage/gcs/gcs_storage_client.go @@ -227,6 +227,9 @@ func (gcs *gcsRemoteStorageClient) WriteFile(loc *remote_pb.RemoteStorageLocatio metadata := toMetadata(entry.Extended) wc := gcs.client.Bucket(loc.Bucket).Object(key).NewWriter(context.Background()) wc.Metadata = metadata + if entry.Attributes != nil && entry.Attributes.Mime != "" { + wc.ContentType = entry.Attributes.Mime + } if _, err = io.Copy(wc, reader); err != nil { return nil, fmt.Errorf("upload to gcs %s/%s%s: %v", loc.Name, loc.Bucket, loc.Path, err) }