aboutsummaryrefslogtreecommitdiff
path: root/src/api/api_server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-26 20:46:21 +0000
committerAlex Auvolat <alex@adnab.me>2020-04-26 20:46:33 +0000
commit0877a5500cca4f3aa85da4fff4225b154a159a09 (patch)
treecb7d7cc1b2d9815161296c46a7d7b1e7378ce7c3 /src/api/api_server.rs
parent81ecc4999e16c58ce6d0e97501f7b6b1497f6cf6 (diff)
downloadgarage-0877a5500cca4f3aa85da4fff4225b154a159a09.tar.gz
garage-0877a5500cca4f3aa85da4fff4225b154a159a09.zip
Abort multipart upload
Diffstat (limited to 'src/api/api_server.rs')
-rw-r--r--src/api/api_server.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/api/api_server.rs b/src/api/api_server.rs
index 947d1a91..b92f4403 100644
--- a/src/api/api_server.rs
+++ b/src/api/api_server.rs
@@ -120,6 +120,7 @@ async fn handler_inner(
.iter()
.all(|x| params.contains_key(&x.to_string()))
{
+ // UploadPart query
let part_number = params.get("partnumber").unwrap();
let upload_id = params.get("uploadid").unwrap();
Ok(handle_put_part(garage, req, &bucket, &key, part_number, upload_id).await?)
@@ -129,16 +130,23 @@ async fn handler_inner(
}
}
&Method::DELETE => {
- // DeleteObject query
- let version_uuid = handle_delete(garage, &bucket, &key).await?;
- let response = format!("{}\n", hex::encode(version_uuid));
- Ok(Response::new(Box::new(BytesBody::from(response))))
+ if params.contains_key(&"uploadid".to_string()) {
+ // AbortMultipartUpload query
+ let upload_id = params.get("uploadid").unwrap();
+ Ok(handle_abort_multipart_upload(garage, &bucket, &key, upload_id).await?)
+ } else {
+ // DeleteObject query
+ let version_uuid = handle_delete(garage, &bucket, &key).await?;
+ let response = format!("{}\n", hex::encode(version_uuid));
+ Ok(Response::new(Box::new(BytesBody::from(response))))
+ }
}
&Method::POST => {
if params.contains_key(&"uploads".to_string()) {
// CreateMultipartUpload call
Ok(handle_create_multipart_upload(garage, &req, &bucket, &key).await?)
} else if params.contains_key(&"uploadid".to_string()) {
+ // CompleteMultipartUpload call
let upload_id = params.get("uploadid").unwrap();
Ok(handle_complete_multipart_upload(garage, req, &bucket, &key, upload_id).await?)
} else {