mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-25 09:31:00 +00:00
Remove leading / in keys; better delimiter handling
This commit is contained in:
parent
be4831d768
commit
e3203f998b
2 changed files with 8 additions and 3 deletions
|
@ -78,6 +78,7 @@ async fn handler_inner(
|
|||
let (bucket, key) = match path.find('/') {
|
||||
Some(i) => {
|
||||
let (bucket, key) = path.split_at(i);
|
||||
let key = key.trim_start_matches('/');
|
||||
(bucket, Some(key))
|
||||
}
|
||||
None => (path, None),
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue