mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-29 03:21: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('/') {
|
let (bucket, key) = match path.find('/') {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
let (bucket, key) = path.split_at(i);
|
let (bucket, key) = path.split_at(i);
|
||||||
|
let key = key.trim_start_matches('/');
|
||||||
(bucket, Some(key))
|
(bucket, Some(key))
|
||||||
}
|
}
|
||||||
None => (path, None),
|
None => (path, None),
|
||||||
|
|
|
@ -55,9 +55,13 @@ pub async fn handle_list(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let delimited_key = match relative_key.find(delimiter) {
|
let delimited_key = if delimiter.len() > 0 {
|
||||||
Some(i) => relative_key.split_at(i).1,
|
match relative_key.find(delimiter) {
|
||||||
|
Some(i) => relative_key.split_at(i).0,
|
||||||
None => &relative_key,
|
None => &relative_key,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
&relative_key
|
||||||
};
|
};
|
||||||
let delimited_key = delimited_key.to_string();
|
let delimited_key = delimited_key.to_string();
|
||||||
let new_info = match result.get(&delimited_key) {
|
let new_info = match result.get(&delimited_key) {
|
||||||
|
|
Loading…
Reference in a new issue