From a8766626403c310d80139ab0660221f5d5aa4f22 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Sun, 2 May 2021 22:30:56 +0200 Subject: S3 API: support ListBuckets --- src/api/api_server.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/api/api_server.rs') diff --git a/src/api/api_server.rs b/src/api/api_server.rs index ab8bd736..8a51b851 100644 --- a/src/api/api_server.rs +++ b/src/api/api_server.rs @@ -81,10 +81,12 @@ async fn handler( async fn handler_inner(garage: Arc, req: Request) -> Result, Error> { let path = req.uri().path().to_string(); let path = percent_encoding::percent_decode_str(&path).decode_utf8()?; + let (api_key, content_sha256) = check_signature(&garage, &req).await?; + if path == "/" { + return handle_list_buckets(&api_key); + } let (bucket, key) = parse_bucket_key(&path)?; - - let (api_key, content_sha256) = check_signature(&garage, &req).await?; let allowed = match req.method() { &Method::HEAD | &Method::GET => api_key.allow_read(&bucket), _ => api_key.allow_write(&bucket), -- cgit v1.2.3