Skip to content

mirror does not preserve Content-Type when copying objects between S3 backends #59

@makhomed

Description

@makhomed

When mirroring objects between two S3-compatible backends with:

rc mirror stage/bucket prod/bucket

the destination object loses its original Content-Type.
Example: a source object with Content-Type image/jpeg becomes
application/octet-stream on the target.

From the code, mirror currently does:

  • source_client.get_object(&source_full)
  • target_client.put_object(&target_full, data, None)

So the upload is performed without passing Content-Type at all.

S3Client::head_object() already reads content_type() into ObjectInfo,
so a minimal fix would be to fetch source metadata first and pass
source_info.content_type.as_deref() into put_object().

This likely affects not only Content-Type but potentially other object metadata as well.

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