diff options
author | Rutger Broekhoff | 2024-01-24 18:45:26 +0100 |
---|---|---|
committer | Rutger Broekhoff | 2024-01-24 18:45:26 +0100 |
commit | 5807dcc8969a6062fd989bd61bd7e7658ca573fe (patch) | |
tree | 32e7a5355b51c6e150c3a010f45f0fd61e47b5e8 /rs/server/src | |
parent | c31705b0228cf3b7eea5a9fece27847a17680a4e (diff) | |
download | gitolfs3-5807dcc8969a6062fd989bd61bd7e7658ca573fe.tar.gz gitolfs3-5807dcc8969a6062fd989bd61bd7e7658ca573fe.zip |
Fix presigned URL generation
Diffstat (limited to 'rs/server/src')
-rw-r--r-- | rs/server/src/main.rs | 15 |
1 files changed, 12 insertions, 3 deletions
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( | |||
462 | .s3_client | 462 | .s3_client |
463 | .head_object() | 463 | .head_object() |
464 | .bucket(&state.s3_bucket) | 464 | .bucket(&state.s3_bucket) |
465 | .key(full_path) | 465 | .key(full_path.clone()) |
466 | .checksum_mode(aws_sdk_s3::types::ChecksumMode::Enabled) | 466 | .checksum_mode(aws_sdk_s3::types::ChecksumMode::Enabled) |
467 | .send() | 467 | .send() |
468 | .await | 468 | .await |
@@ -496,6 +496,8 @@ async fn handle_upload_object( | |||
496 | let Ok(presigned) = state | 496 | let Ok(presigned) = state |
497 | .s3_client | 497 | .s3_client |
498 | .put_object() | 498 | .put_object() |
499 | .bucket(&state.s3_bucket) | ||
500 | .key(full_path) | ||
499 | .checksum_sha256(obj.oid.to_string()) | 501 | .checksum_sha256(obj.oid.to_string()) |
500 | .content_length(obj.size) | 502 | .content_length(obj.size) |
501 | .presigned(config) | 503 | .presigned(config) |
@@ -539,7 +541,7 @@ async fn handle_download_object( | |||
539 | .s3_client | 541 | .s3_client |
540 | .head_object() | 542 | .head_object() |
541 | .bucket(&state.s3_bucket) | 543 | .bucket(&state.s3_bucket) |
542 | .key(full_path) | 544 | .key(&full_path) |
543 | .checksum_mode(aws_sdk_s3::types::ChecksumMode::Enabled) | 545 | .checksum_mode(aws_sdk_s3::types::ChecksumMode::Enabled) |
544 | .send() | 546 | .send() |
545 | .await | 547 | .await |
@@ -582,7 +584,14 @@ async fn handle_download_object( | |||
582 | "Failed to generate upload URL".to_string(), | 584 | "Failed to generate upload URL".to_string(), |
583 | ); | 585 | ); |
584 | }; | 586 | }; |
585 | let Ok(presigned) = state.s3_client.get_object().presigned(config).await else { | 587 | let Ok(presigned) = state |
588 | .s3_client | ||
589 | .get_object() | ||
590 | .bucket(&state.s3_bucket) | ||
591 | .key(full_path) | ||
592 | .presigned(config) | ||
593 | .await | ||
594 | else { | ||
586 | return BatchResponseObject::error( | 595 | return BatchResponseObject::error( |
587 | obj, | 596 | obj, |
588 | StatusCode::INTERNAL_SERVER_ERROR, | 597 | StatusCode::INTERNAL_SERVER_ERROR, |