Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrise committed Mar 30, 2024
1 parent 4c492b7 commit 693afe8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/cloud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ aws-sdk-secretsmanager = { workspace = true, optional = true }
aws-sdk-s3 = { workspace = true, optional = true }
aws-sdk-sqs = { workspace = true, optional = true }
aws-sdk-sesv2 = { workspace = true, optional = true }
urlencoding = { workspace = true }

[dev-dependencies]
testcontainers = { workspace = true }
5 changes: 4 additions & 1 deletion modules/cloud/src/aws/s3/s3_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use chrono::{DateTime, Duration, Utc};
use tokio::fs::File;
use tokio::io::AsyncWriteExt;
use tokio_stream::StreamExt;
use urlencoding::encode;

#[async_trait]
pub trait S3Client {
Expand All @@ -28,12 +29,14 @@ impl S3Client for S3ClientImpl {
.expires_in(expires_in.to_std()?)
.build()?;

let encoded_filename = encode(filename).to_string();

let request = self
.client
.get_object()
.bucket(self.bucket.as_str())
.key(key)
.set_response_content_disposition(Some(format!("attachment; filename=\"{filename}\"")))
.set_response_content_disposition(Some(format!("attachment; filename*=UTF-8''\"{encoded_filename}\"")))
.presigned(presigning_config)
.await?;
Ok(request.uri().to_string())
Expand Down

0 comments on commit 693afe8

Please sign in to comment.