From edc80a9044911239a328d5e0fb5702a61f2ce7f3 Mon Sep 17 00:00:00 2001 From: LightQuantum Date: Tue, 22 Aug 2023 05:52:41 +0800 Subject: [PATCH] fix(gateway): unnecessarily appending namespace after s3 prefix BREAKING CHANGE: gateway won't append namespace after s3_prefix automatically --- rsync-gateway/src/path_resolve.rs | 4 ++-- rsync-gateway/src/tests.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rsync-gateway/src/path_resolve.rs b/rsync-gateway/src/path_resolve.rs index a06e558..85fc1a2 100644 --- a/rsync-gateway/src/path_resolve.rs +++ b/rsync-gateway/src/path_resolve.rs @@ -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; diff --git a/rsync-gateway/src/tests.rs b/rsync-gateway/src/tests.rs index 966fc1e..2ada09f 100644 --- a/rsync-gateway/src/tests.rs +++ b/rsync-gateway/src/tests.rs @@ -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(), }, },