diff --git a/core/services/s3/src/backend.rs b/core/services/s3/src/backend.rs index 3fd62ee694c5..fb34f1711c0a 100644 --- a/core/services/s3/src/backend.rs +++ b/core/services/s3/src/backend.rs @@ -942,6 +942,7 @@ impl Builder for S3Builder { presign_stat: true, presign_read: true, presign_write: true, + presign_delete: true, shared: true, @@ -1123,10 +1124,7 @@ impl Access for S3Backend { self.core .s3_put_object_request(path, None, &v, Buffer::new()) } - PresignOperation::Delete(_) => Err(Error::new( - ErrorKind::Unsupported, - "operation is not supported", - )), + PresignOperation::Delete(v) => self.core.s3_delete_object_request(path, &v), _ => Err(Error::new( ErrorKind::Unsupported, "operation is not supported", diff --git a/core/services/s3/src/core.rs b/core/services/s3/src/core.rs index 643c95dc98cb..b289bb3c6d25 100644 --- a/core/services/s3/src/core.rs +++ b/core/services/s3/src/core.rs @@ -600,7 +600,11 @@ impl S3Core { self.send(req).await } - pub async fn s3_delete_object(&self, path: &str, args: &OpDelete) -> Result> { + pub async fn s3_delete_object_request( + &self, + path: &str, + args: &OpDelete, + ) -> Result> { let p = build_abs_path(&self.root, path); let mut url = format!("{}/{}", self.endpoint, percent_encode_path(&p)); @@ -630,7 +634,7 @@ impl S3Core { .body(Buffer::new()) .map_err(new_request_build_error)?; - self.send(req).await + Ok(req) } pub async fn s3_copy_object(&self, from: &str, to: &str) -> Result> { diff --git a/core/services/s3/src/deleter.rs b/core/services/s3/src/deleter.rs index feb9ff90bb71..69bb41cc8e9e 100644 --- a/core/services/s3/src/deleter.rs +++ b/core/services/s3/src/deleter.rs @@ -44,7 +44,9 @@ impl oio::BatchDelete for S3Deleter { return Ok(()); } - let resp = self.core.s3_delete_object(&path, &args).await?; + let req = self.core.s3_delete_object_request(&path, &args).await?; + + let resp = self.core.send(req).await?; let status = resp.status();