diff options
author | Alex Auvolat <alex@adnab.me> | 2022-05-13 19:18:51 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-05-13 19:18:51 +0200 |
commit | ea325d78d36d19f59a0849ace1f4567e2b095bd7 (patch) | |
tree | bfc05dd1f8df3d1fae84a1af433f4ae56dbc2c31 /src/api/s3/copy.rs | |
parent | ec16d166f940f59098ae5cc0c0b3d8298f1bcc78 (diff) | |
download | garage-ea325d78d36d19f59a0849ace1f4567e2b095bd7.tar.gz garage-ea325d78d36d19f59a0849ace1f4567e2b095bd7.zip |
More error refactoring
Diffstat (limited to 'src/api/s3/copy.rs')
-rw-r--r-- | src/api/s3/copy.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/api/s3/copy.rs b/src/api/s3/copy.rs index 2468678e..0fc16993 100644 --- a/src/api/s3/copy.rs +++ b/src/api/s3/copy.rs @@ -18,8 +18,8 @@ use garage_model::s3::block_ref_table::*; use garage_model::s3::object_table::*; use garage_model::s3::version_table::*; +use crate::helpers::parse_bucket_key; use crate::s3::error::*; -use crate::helpers::{parse_bucket_key}; use crate::s3::put::{decode_upload_id, get_headers}; use crate::s3::xml::{self as s3_xml, xmlns_tag}; @@ -413,10 +413,13 @@ async fn get_copy_source( let copy_source = percent_encoding::percent_decode_str(copy_source).decode_utf8()?; let (source_bucket, source_key) = parse_bucket_key(©_source, None)?; - let source_bucket_id = garage.bucket_helper().resolve_bucket(&source_bucket.to_string(), api_key).await?; + let source_bucket_id = garage + .bucket_helper() + .resolve_bucket(&source_bucket.to_string(), api_key) + .await?; if !api_key.allow_read(&source_bucket_id) { - return Err(Error::Forbidden(format!( + return Err(Error::forbidden(format!( "Reading from bucket {} not allowed for this key", source_bucket ))); |