Skip to content

Commit

Permalink
Utils: Fix S3Key when prefix is missing. (#29)
Browse files Browse the repository at this point in the history
Without a prefix, S3Keys have leading slashes which not only causes an empty `/` folder at the root of S3 buckets but causes `get_all_entries` to fail to list items due to the trailing slashes not being correct keyexpr.
  • Loading branch information
chachi authored Jan 9, 2024
1 parent 57fd050 commit 768aabd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl From<S3Key> for String {
s3_key.prefix.as_ref().map_or_else(
// For compatibility purposes between Amazon S3 and MinIO S3 implementations we trim
// the '/' character.
|| format!("/{}", s3_key.key.trim_start_matches('/')),
|| s3_key.key.trim_start_matches('/').to_owned(),
|prefix| s3_key.key.trim_start_matches(prefix).to_owned(),
)
}
Expand Down

0 comments on commit 768aabd

Please sign in to comment.