Skip to content

Commit

Permalink
fix(gateway): unnecessarily appending namespace after s3 prefix
Browse files Browse the repository at this point in the history
BREAKING CHANGE: gateway won't append namespace after s3_prefix automatically
  • Loading branch information
PhotonQuantum committed Aug 21, 2023
1 parent 2b23980 commit edc80a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rsync-gateway/src/path_resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ pub async fn resolve<'a>(
let content_disposition =
format!("attachment; filename=\"{encoded_name}\"; filename*=UTF-8''{encoded_name}");
let s3_path = if s3_prefix.is_empty() {
format!("{namespace}/{:x}", blake2b.as_hex())
format!("{:x}", blake2b.as_hex())
} else {
format!("{s3_prefix}/{namespace}/{:x}", blake2b.as_hex())
format!("{s3_prefix}/{:x}", blake2b.as_hex())
};
// Expire the pre-signed URL halfway through its lifetime.
let expired_at = Instant::now() + PRESIGN_TIMEOUT / 2;
Expand Down
2 changes: 1 addition & 1 deletion rsync-gateway/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ mod db_required {
String::from("test") =>
Endpoint {
s3_bucket: String::new(),
s3_prefix: String::new(),
s3_prefix: namespace.clone(),
namespace: namespace.clone(),
},
},
Expand Down

0 comments on commit edc80a9

Please sign in to comment.