From: Hannes Laimer <h.laimer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests
Date: Mon, 16 Mar 2026 15:19:40 +0100 [thread overview]
Message-ID: <20260316141940.3576-1-h.laimer@proxmox.com> (raw)
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(©_source)?)
+ .header(header::CONTENT_TYPE, "application/octet-stream")
.header(
"x-amz-metadata-directive",
HeaderValue::from_str("REPLACE")?,
--
2.47.3
next reply other threads:[~2026-03-16 14:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 14:19 Hannes Laimer [this message]
2026-03-16 14:22 ` Hannes Laimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260316141940.3576-1-h.laimer@proxmox.com \
--to=h.laimer@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox