aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_list.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-24 22:28:15 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-24 22:28:15 +0200
commite3203f998b153d85199a322e8b6fee72a90c32c9 (patch)
tree254448980c2ccd1c340591fa11ec5adaea01f63f /src/api/s3_list.rs
parentbe4831d7687b59eb4a8f7a2856554f9157cc998d (diff)
downloadgarage-e3203f998b153d85199a322e8b6fee72a90c32c9.tar.gz
garage-e3203f998b153d85199a322e8b6fee72a90c32c9.zip
Remove leading / in keys; better delimiter handling
Diffstat (limited to 'src/api/s3_list.rs')
-rw-r--r--src/api/s3_list.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs
index af160ac2..35140d1e 100644
--- a/src/api/s3_list.rs
+++ b/src/api/s3_list.rs
@@ -55,9 +55,13 @@ pub async fn handle_list(
break;
}
};
- let delimited_key = match relative_key.find(delimiter) {
- Some(i) => relative_key.split_at(i).1,
- None => &relative_key,
+ let delimited_key = if delimiter.len() > 0 {
+ match relative_key.find(delimiter) {
+ Some(i) => relative_key.split_at(i).0,
+ None => &relative_key,
+ }
+ } else {
+ &relative_key
};
let delimited_key = delimited_key.to_string();
let new_info = match result.get(&delimited_key) {