aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/api_server.rs8
-rw-r--r--src/api/s3_bucket.rs2
-rw-r--r--src/api/s3_website.rs2
3 files changed, 4 insertions, 8 deletions
diff --git a/src/api/api_server.rs b/src/api/api_server.rs
index cd866c9f..42987e78 100644
--- a/src/api/api_server.rs
+++ b/src/api/api_server.rs
@@ -109,11 +109,9 @@ async fn handler_inner(garage: Arc<Garage>, req: Request<Body>) -> Result<Respon
let endpoint = Endpoint::from_request(&req, bucket.map(ToOwned::to_owned))?;
- let bucket_name = match endpoint.authorization_type() {
- Authorization::None => {
- return handle_request_without_bucket(garage, req, api_key, endpoint).await
- }
- Authorization::Read(bucket) | Authorization::Write(bucket) => bucket.to_string(),
+ let bucket_name = match endpoint.get_bucket() {
+ None => return handle_request_without_bucket(garage, req, api_key, endpoint).await,
+ Some(bucket) => bucket.to_string(),
};
let bucket_id = resolve_bucket(&garage, &bucket_name, &api_key).await?;
diff --git a/src/api/s3_bucket.rs b/src/api/s3_bucket.rs
index dc131a31..4a497c67 100644
--- a/src/api/s3_bucket.rs
+++ b/src/api/s3_bucket.rs
@@ -67,7 +67,7 @@ pub async fn handle_list_buckets(garage: &Garage, api_key: &Key) -> Result<Respo
if let Some(alias_ent) = alias_ent {
if let Some(alias_p) = alias_ent.state.get().as_option() {
if alias_p.bucket_id == *bucket_id {
- aliases.insert(alias_ent.name.clone(), *bucket_id);
+ aliases.insert(alias_ent.name().to_string(), *bucket_id);
}
}
}
diff --git a/src/api/s3_website.rs b/src/api/s3_website.rs
index 8a93e8c5..e76afbf4 100644
--- a/src/api/s3_website.rs
+++ b/src/api/s3_website.rs
@@ -25,7 +25,6 @@ pub async fn handle_delete_website(
.ok_or(Error::NotFound)?;
if let crdt::Deletable::Present(param) = &mut bucket.state {
- param.website_access.update(false);
param.website_config.update(None);
garage.bucket_table.insert(&bucket).await?;
} else {
@@ -57,7 +56,6 @@ pub async fn handle_put_website(
conf.validate()?;
if let crdt::Deletable::Present(param) = &mut bucket.state {
- param.website_access.update(true);
param
.website_config
.update(Some(ByteBuf::from(body.to_vec())));