From 5d3829b8d0a5257de5b31f70d9b2b4de7bb5ea87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Galkin?= Date: Fri, 21 Feb 2025 18:37:21 -0300 Subject: [PATCH] Only write content-type if the object store accepts metadata (#769) See: #743 --- icechunk/src/storage/s3.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/icechunk/src/storage/s3.rs b/icechunk/src/storage/s3.rs index 197add32..37726d89 100644 --- a/icechunk/src/storage/s3.rs +++ b/icechunk/src/storage/s3.rs @@ -205,9 +205,11 @@ impl S3Storage { let mut b = self.get_client().await.put_object().bucket(self.bucket.clone()).key(key); - if let Some(ct) = content_type { - b = b.content_type(ct) - }; + if settings.unsafe_use_metadata() { + if let Some(ct) = content_type { + b = b.content_type(ct) + }; + } if settings.unsafe_use_metadata() { for (k, v) in metadata { @@ -312,9 +314,12 @@ impl Storage for S3Storage { .put_object() .bucket(self.bucket.clone()) .key(key) - .content_type("application/yaml") .body(config.into()); + if settings.unsafe_use_metadata() { + req = req.content_type("application/yaml") + } + match ( previous_version.etag(), settings.unsafe_use_conditional_create(),