diff options
Diffstat (limited to 'src/api/s3_list.rs')
-rw-r--r-- | src/api/s3_list.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs index 0a3b62ec..9e6bc0f5 100644 --- a/src/api/s3_list.rs +++ b/src/api/s3_list.rs @@ -64,10 +64,9 @@ pub async fn handle_list( } let common_prefix = if delimiter.len() > 0 { let relative_key = &object.key[prefix.len()..]; - match relative_key.find(delimiter) { - Some(i) => Some(&object.key[..prefix.len() + i + delimiter.len()]), - None => None, - } + relative_key + .find(delimiter) + .and_then(move |i| Some(&object.key[..prefix.len() + i + delimiter.len()])) } else { None }; |