Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(source): cherry-pick #15530 #15581

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/connector/src/aws_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use std::collections::HashMap;
use std::time::Duration;

use anyhow::anyhow;
use aws_config::timeout::TimeoutConfig;
use aws_sdk_s3::error::DisplayErrorContext;
use aws_sdk_s3::{client as s3_client, config as s3_config};
Expand Down Expand Up @@ -112,13 +113,16 @@ pub async fn load_file_descriptor_from_s3(
let bucket = location
.domain()
.ok_or_else(|| RwError::from(InternalError(format!("Illegal file path {}", location))))?;
let key = location.path().replace('/', "");
let key = location
.path()
.strip_prefix('/')
.ok_or_else(|| anyhow!("s3 url {location} should have a '/' at the start of path."))?;
let sdk_config = config.build_config().await?;
let s3_client = s3_client(&sdk_config, Some(default_conn_config()));
let response = s3_client
.get_object()
.bucket(bucket.to_string())
.key(&key)
.key(key)
.send()
.await
.map_err(|e| {
Expand Down
Loading