use proper error code for unsupported anonymous s3 access

This commit is contained in:
Trinity Pointard 2021-12-18 21:10:44 +01:00
parent 945b75dbf1
commit 914dd0559c

View file

@ -165,9 +165,9 @@ fn parse_authorization(
}
fn parse_query_authorization(headers: &HashMap<String, String>) -> Result<Authorization, Error> {
let algo = headers
.get("x-amz-algorithm")
.ok_or_bad_request("X-Amz-Algorithm not found in query parameters")?;
let algo = headers.get("x-amz-algorithm").ok_or_else(|| {
Error::Forbidden("Garage does not support anonymous users yet".to_owned())
})?;
if algo != "AWS4-HMAC-SHA256" {
return Err(Error::BadRequest(
"Unsupported authorization method".to_string(),