Skip to content

Commit 5d3829b

Browse files
authored
Only write content-type if the object store accepts metadata (#769)
See: #743
1 parent 33f41e8 commit 5d3829b

File tree

1 file changed

+9
-4
lines changed
  • icechunk/src/storage

1 file changed

+9
-4
lines changed

icechunk/src/storage/s3.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,11 @@ impl S3Storage {
205205
let mut b =
206206
self.get_client().await.put_object().bucket(self.bucket.clone()).key(key);
207207

208-
if let Some(ct) = content_type {
209-
b = b.content_type(ct)
210-
};
208+
if settings.unsafe_use_metadata() {
209+
if let Some(ct) = content_type {
210+
b = b.content_type(ct)
211+
};
212+
}
211213

212214
if settings.unsafe_use_metadata() {
213215
for (k, v) in metadata {
@@ -312,9 +314,12 @@ impl Storage for S3Storage {
312314
.put_object()
313315
.bucket(self.bucket.clone())
314316
.key(key)
315-
.content_type("application/yaml")
316317
.body(config.into());
317318

319+
if settings.unsafe_use_metadata() {
320+
req = req.content_type("application/yaml")
321+
}
322+
318323
match (
319324
previous_version.etag(),
320325
settings.unsafe_use_conditional_create(),

0 commit comments

Comments
 (0)