public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests
@ 2026-03-16 14:19 Hannes Laimer
  2026-03-16 14:22 ` Hannes Laimer
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Laimer @ 2026-03-16 14:19 UTC (permalink / raw)
  To: pbs-devel

Use the IANA registered `application/octet-stream` content type instead
of the non-standard `binary/octet` value in put_object.

Also set Content-Type explicitly in copy_object requests, since some S3
providers drop all source metadata, including Content-Type, when using
x-amz-metadata-directive REPLACE unless it is explicitly provided. This
caused s3_refresh to fail with "missing header 'content-type'" on such
providers when fetching objects moved via copy_object.

Setting it unconditionally is safe, since put_object already does the
same.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
did notice this with RustFS, MinIO did not have that problem

v2, thanks @Chris:
 - use `application/octet-stream`
 - also change to `application/octet-stream` in `put_object`


 proxmox-s3-client/src/client.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
index 413b3984..fbffe3e9 100644
--- a/proxmox-s3-client/src/client.rs
+++ b/proxmox-s3-client/src/client.rs
@@ -530,7 +530,7 @@ impl S3Client {
         let mut request = Request::builder()
             .method(Method::PUT)
             .uri(self.build_uri(&object_key, &[])?)
-            .header(header::CONTENT_TYPE, "binary/octet");
+            .header(header::CONTENT_TYPE, "application/octet-stream");
 
         if !replace {
             // Some providers not implement this and fails with error if the header is set,
@@ -660,6 +660,7 @@ impl S3Client {
             .method(Method::PUT)
             .uri(self.build_uri(&destination_key, &[])?)
             .header("x-amz-copy-source", HeaderValue::from_str(&copy_source)?)
+            .header(header::CONTENT_TYPE, "application/octet-stream")
             .header(
                 "x-amz-metadata-directive",
                 HeaderValue::from_str("REPLACE")?,
-- 
2.47.3





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-16 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-16 14:19 [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests Hannes Laimer
2026-03-16 14:22 ` Hannes Laimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal