From 39f3c7707b29fd12b304e65ba0505bf0b463b076 Mon Sep 17 00:00:00 2001 From: rm-dr <96270320+rm-dr@users.noreply.github.com> Date: Sat, 21 Mar 2026 10:50:04 -0700 Subject: [PATCH] Fix S3 source --- crates/pile-value/src/value/item.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/pile-value/src/value/item.rs b/crates/pile-value/src/value/item.rs index e4fc4a9..f322faa 100644 --- a/crates/pile-value/src/value/item.rs +++ b/crates/pile-value/src/value/item.rs @@ -40,11 +40,22 @@ impl Item { Self::File { path, .. } => ItemReader::File(File::open(path)?), Self::S3 { source, key, .. } => { + let full_key: SmartString = match &source.prefix { + None => key.clone(), + Some(p) => { + if p.ends_with('/') { + format!("{p}{key}").into() + } else { + format!("{p}/{key}").into() + } + } + }; + let head = source .client .head_object() .bucket(source.bucket.as_str()) - .key(key.as_str()) + .key(full_key.as_str()) .send() .await .map_err(std::io::Error::other)?; @@ -54,7 +65,7 @@ impl Item { ItemReader::S3(S3Reader { client: source.client.clone(), bucket: source.bucket.clone(), - key: key.to_owned(), + key: full_key, cursor: 0, size, })