From 1b9322bea2b8d458384117585aed5c444cd13334 Mon Sep 17 00:00:00 2001 From: Ion Koutsouris <15728914+ion-elgreco@users.noreply.github.com> Date: Sun, 8 Sep 2024 11:26:58 +0200 Subject: [PATCH] fix: set put mode to overwrite in mount backend --- crates/mount/src/file.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/mount/src/file.rs b/crates/mount/src/file.rs index 29285a4a96..090562d442 100644 --- a/crates/mount/src/file.rs +++ b/crates/mount/src/file.rs @@ -9,7 +9,7 @@ use object_store::{ GetResult, ListResult, ObjectMeta, ObjectStore, PutOptions, PutResult, Result as ObjectStoreResult, }; -use object_store::{MultipartUpload, PutMultipartOpts, PutPayload}; +use object_store::{MultipartUpload, PutMode, PutMultipartOpts, PutPayload}; use std::ops::Range; use std::sync::Arc; use url::Url; @@ -168,8 +168,11 @@ impl ObjectStore for MountFileStorageBackend { &self, location: &ObjectStorePath, bytes: PutPayload, - options: PutOptions, + mut options: PutOptions, ) -> ObjectStoreResult { + // In mounted storage we do an unsafe rename/overwrite + // We don't conditionally check whether the file already exists + options.mode = PutMode::Overwrite; self.inner.put_opts(location, bytes, options).await }