This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new db6848906 fix(services/s3): allow 404 resp when deleting a 
non-existing object (#2941)
db6848906 is described below

commit db6848906c2be14738dfc351a324da5974183eca
Author: Yisheng Gong <[email protected]>
AuthorDate: Fri Aug 25 23:47:56 2023 -0700

    fix(services/s3): allow 404 resp when deleting a non-existing object (#2941)
---
 core/src/services/s3/backend.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/src/services/s3/backend.rs b/core/src/services/s3/backend.rs
index db8c4db00..a773da3a8 100644
--- a/core/src/services/s3/backend.rs
+++ b/core/src/services/s3/backend.rs
@@ -1052,6 +1052,10 @@ impl Accessor for S3Backend {
 
         match status {
             StatusCode::NO_CONTENT => Ok(RpDelete::default()),
+            // Allow 404 when deleting a non-existing object
+            // This is not a standard behavior, only some s3 alike service 
like GCS XML API do this.
+            // ref: 
<https://cloud.google.com/storage/docs/xml-api/delete-object>
+            StatusCode::NOT_FOUND => Ok(RpDelete::default()),
             _ => Err(parse_error(resp).await?),
         }
     }

Reply via email to