aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2022-09-14 17:16:39 +0200
committerAlex <alex@adnab.me>2022-09-14 17:16:39 +0200
commit89b8087ba81c508ba382aa6c9cb6bb3afa6a43c8 (patch)
tree1f9ad320ae90c62da74a311b86cc814d62f8b072 /src/api
parent82600acf776acecfa73fbf23d4c7107eaae81e09 (diff)
parent76f42a1a2b5cf088968a0730cf6de31b75f7a055 (diff)
downloadgarage-89b8087ba81c508ba382aa6c9cb6bb3afa6a43c8.tar.gz
garage-89b8087ba81c508ba382aa6c9cb6bb3afa6a43c8.zip
Merge pull request 'Properly return HTTP 204 when deleting non-existent object (fix #227)' (#384) from deleteobject-204 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/384
Diffstat (limited to 'src/api')
-rw-r--r--src/api/s3/delete.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/api/s3/delete.rs b/src/api/s3/delete.rs
index 5065b285..b337155f 100644
--- a/src/api/s3/delete.rs
+++ b/src/api/s3/delete.rs
@@ -64,14 +64,13 @@ pub async fn handle_delete(
bucket_id: Uuid,
key: &str,
) -> Result<Response<Body>, Error> {
- let (_deleted_version, delete_marker_version) =
- handle_delete_internal(&garage, bucket_id, key).await?;
-
- Ok(Response::builder()
- .header("x-amz-version-id", hex::encode(delete_marker_version))
- .status(StatusCode::NO_CONTENT)
- .body(Body::from(vec![]))
- .unwrap())
+ match handle_delete_internal(&garage, bucket_id, key).await {
+ Ok(_) | Err(Error::NoSuchKey) => Ok(Response::builder()
+ .status(StatusCode::NO_CONTENT)
+ .body(Body::from(vec![]))
+ .unwrap()),
+ Err(e) => Err(e),
+ }
}
pub async fn handle_delete_objects(