aboutsummaryrefslogtreecommitdiff
path: root/aero-proto/src/dav
diff options
context:
space:
mode:
Diffstat (limited to 'aero-proto/src/dav')
-rw-r--r--aero-proto/src/dav/controller.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/aero-proto/src/dav/controller.rs b/aero-proto/src/dav/controller.rs
index 306b035..0a47cf4 100644
--- a/aero-proto/src/dav/controller.rs
+++ b/aero-proto/src/dav/controller.rs
@@ -223,7 +223,15 @@ impl Controller {
})
.boxed();
- let etag = self.node.put(put_policy, stream_of_bytes).await?;
+ let etag = match self.node.put(put_policy, stream_of_bytes).await {
+ Ok(etag) => etag,
+ Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => {
+ tracing::warn!("put pre-condition failed");
+ let response = Response::builder().status(412).body(text_body(""))?;
+ return Ok(response);
+ }
+ Err(e) => Err(e)?,
+ };
let response = Response::builder()
.status(201)