mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-04 07:07:18 +00:00
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).
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user