Skip to content

Feature Request: Add content_type option to gcp_cloud_storage sink #24410

@sorokinvj

Description

@sorokinvj

Feature Request: Add content_type option to gcp_cloud_storage sink

Problem

The aws_s3 sink supports a content_type configuration option to override the MIME type of uploaded objects:

[sinks.s3]
type = "aws_s3"
content_type = "text/plain; charset=utf-8"

However, the gcp_cloud_storage sink does not have this option. This makes it impossible to set the correct Content-Type header (including charset) for objects uploaded to GCS.

Use Case

When uploading UTF-8 text files to GCS, the browser preview shows corrupted characters (mojibake) because GCS defaults to text/plain without charset=utf-8. Users need to manually patch objects after upload or use Cloud Functions as a workaround.

Expected Behavior

Add content_type option to gcp_cloud_storage sink, matching the aws_s3 sink behavior:

[sinks.gcs]
type = "gcp_cloud_storage"
bucket = "my-bucket"
content_type = "text/plain; charset=utf-8"

[sinks.gcs.encoding]
codec = "text"

Current Workaround

  • Post-upload Cloud Function to patch Content-Type metadata
  • Manual gcloud storage objects update --content-type after upload

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions