From 768aabd8ac22c5f939de68537f4fb6c099575faa Mon Sep 17 00:00:00 2001 From: Jack Morrison Date: Tue, 9 Jan 2024 04:48:53 -0700 Subject: [PATCH] Utils: Fix S3Key when prefix is missing. (#29) 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. --- src/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.rs b/src/utils.rs index 4e46361..5651808 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -50,7 +50,7 @@ impl From 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(), ) }