aboutsummaryrefslogtreecommitdiff
path: root/src/api/api_server.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2021-05-02 22:30:56 +0200
committerGitea <gitea@fake.local>2021-05-03 21:55:30 +0200
commit631c36b3ff76f9b09a5aed54dc343469a89f9989 (patch)
tree3f9c3b9741de7afb012cd354e3da6316750c13b5 /src/api/api_server.rs
parentee2a3d363b70ca9e7572c30ca9547f7fd7f8f608 (diff)
downloadgarage-631c36b3ff76f9b09a5aed54dc343469a89f9989.tar.gz
garage-631c36b3ff76f9b09a5aed54dc343469a89f9989.zip
S3 API: support ListBuckets
Diffstat (limited to 'src/api/api_server.rs')
-rw-r--r--src/api/api_server.rs6
1 files changed, 4 insertions, 2 deletions
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<Garage>, req: Request<Body>) -> Result<Response<Body>, 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),