From 2ca485fb87125b543307748e73b04bcd68f2d9ad Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 22 May 2024 23:22:03 +0200 Subject: test webdav core get, delete, update --- aero-proto/src/dav/controller.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'aero-proto') 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) -- cgit v1.2.3