diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2021-05-02 22:30:56 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2021-05-02 22:30:56 +0200 |
commit | a8766626403c310d80139ab0660221f5d5aa4f22 (patch) | |
tree | d77d49f3c94ededa95200c1855ab422a19699fb9 /src/api/api_server.rs | |
parent | ef4d6e782a67bd422489d643e8807eaf7fb853c4 (diff) | |
download | garage-feature/s3/list-buckets.tar.gz garage-feature/s3/list-buckets.zip |
S3 API: support ListBucketsfeature/s3/list-buckets
Diffstat (limited to 'src/api/api_server.rs')
-rw-r--r-- | src/api/api_server.rs | 6 |
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), |