diff options
author | Alex Auvolat <alex@adnab.me> | 2023-08-30 23:39:28 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-08-30 23:39:28 +0200 |
commit | f0a395e2e5db977caff0ea46e17061e02929178a (patch) | |
tree | b11aeb39d067bc73fd7b034dcd0993df734b94b2 /src/api/s3/website.rs | |
parent | d94f1c9178da4c346f35c27e4451d1b115b9acfb (diff) | |
download | garage-f0a395e2e5db977caff0ea46e17061e02929178a.tar.gz garage-f0a395e2e5db977caff0ea46e17061e02929178a.zip |
s3 bucket apis: remove redundant call
Diffstat (limited to 'src/api/s3/website.rs')
-rw-r--r-- | src/api/s3/website.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/api/s3/website.rs b/src/api/s3/website.rs index 77738971..7f2ab925 100644 --- a/src/api/s3/website.rs +++ b/src/api/s3/website.rs @@ -43,14 +43,11 @@ pub async fn handle_get_website(bucket: &Bucket) -> Result<Response<Body>, Error pub async fn handle_delete_website( garage: Arc<Garage>, - bucket_id: Uuid, + mut bucket: Bucket, ) -> Result<Response<Body>, Error> { - let mut bucket = garage - .bucket_helper() - .get_existing_bucket(bucket_id) - .await?; - - let param = bucket.params_mut().unwrap(); + let param = bucket + .params_mut() + .ok_or_internal_error("Bucket should not be deleted at this point")?; param.website_config.update(None); garage.bucket_table.insert(&bucket).await?; @@ -62,7 +59,7 @@ pub async fn handle_delete_website( pub async fn handle_put_website( garage: Arc<Garage>, - bucket_id: Uuid, + mut bucket: Bucket, req: Request<Body>, content_sha256: Option<Hash>, ) -> Result<Response<Body>, Error> { @@ -72,12 +69,9 @@ pub async fn handle_put_website( verify_signed_content(content_sha256, &body[..])?; } - let mut bucket = garage - .bucket_helper() - .get_existing_bucket(bucket_id) - .await?; - - let param = bucket.params_mut().unwrap(); + let param = bucket + .params_mut() + .ok_or_internal_error("Bucket should not be deleted at this point")?; let conf: WebsiteConfiguration = from_reader(&body as &[u8])?; conf.validate()?; |