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, })