Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhao-su committed Mar 7, 2024
1 parent 3c3e75f commit 06033b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/connector/src/aws_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use std::collections::HashMap;
use std::time::Duration;

use anyhow::Context;
use anyhow::{anyhow, Context};
use aws_config::timeout::TimeoutConfig;
use aws_sdk_s3::{client as s3_client, config as s3_config};
use url::Url;
Expand Down Expand Up @@ -111,13 +111,15 @@ pub async fn load_file_descriptor_from_s3(
let bucket = location
.domain()
.with_context(|| format!("illegal file path {}", location))?;
let key = location.path().replace('/', "");
let key = location.path().strip_prefix('/').ok_or(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
.with_context(|| format!("failed to get file from s3 at `{}`", location))?;
Expand Down

0 comments on commit 06033b7

Please sign in to comment.