From 5807dcc8969a6062fd989bd61bd7e7658ca573fe Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Wed, 24 Jan 2024 18:45:26 +0100 Subject: Fix presigned URL generation --- rs/server/src/main.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'rs') diff --git a/rs/server/src/main.rs b/rs/server/src/main.rs index d6c780f..7f5a21d 100644 --- a/rs/server/src/main.rs +++ b/rs/server/src/main.rs @@ -462,7 +462,7 @@ async fn handle_upload_object( .s3_client .head_object() .bucket(&state.s3_bucket) - .key(full_path) + .key(full_path.clone()) .checksum_mode(aws_sdk_s3::types::ChecksumMode::Enabled) .send() .await @@ -496,6 +496,8 @@ async fn handle_upload_object( let Ok(presigned) = state .s3_client .put_object() + .bucket(&state.s3_bucket) + .key(full_path) .checksum_sha256(obj.oid.to_string()) .content_length(obj.size) .presigned(config) @@ -539,7 +541,7 @@ async fn handle_download_object( .s3_client .head_object() .bucket(&state.s3_bucket) - .key(full_path) + .key(&full_path) .checksum_mode(aws_sdk_s3::types::ChecksumMode::Enabled) .send() .await @@ -582,7 +584,14 @@ async fn handle_download_object( "Failed to generate upload URL".to_string(), ); }; - let Ok(presigned) = state.s3_client.get_object().presigned(config).await else { + let Ok(presigned) = state + .s3_client + .get_object() + .bucket(&state.s3_bucket) + .key(full_path) + .presigned(config) + .await + else { return BatchResponseObject::error( obj, StatusCode::INTERNAL_SERVER_ERROR, -- cgit v1.2.3