diff options
author | Alex Auvolat <alex@adnab.me> | 2021-02-19 16:44:06 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-02-19 16:44:06 +0100 |
commit | 55a2a636ca0f9a3bf849c7116071750544416530 (patch) | |
tree | a3ee21729c3fc5b003e5516a36d8e53708b3e340 /src/api/api_server.rs | |
parent | 02d512f3fd3bf78b1a0efe410c0704565cab6470 (diff) | |
download | garage-55a2a636ca0f9a3bf849c7116071750544416530.tar.gz garage-55a2a636ca0f9a3bf849c7116071750544416530.zip |
Implement ListObjectsV2
Diffstat (limited to 'src/api/api_server.rs')
-rw-r--r-- | src/api/api_server.rs | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/api/api_server.rs b/src/api/api_server.rs index f0c3f31b..05c09ea7 100644 --- a/src/api/api_server.rs +++ b/src/api/api_server.rs @@ -199,30 +199,8 @@ async fn handler_inner(garage: Arc<Garage>, req: Request<Body>) -> Result<Respon } &Method::GET => { // ListObjects query - let delimiter = params.get("delimiter").map(|x| x.as_str()).unwrap_or(&""); - let max_keys = params - .get("max-keys") - .map(|x| { - x.parse::<usize>() - .ok_or_bad_request("Invalid value for max-keys") - }) - .unwrap_or(Ok(1000))?; - let prefix = params.get("prefix").map(|x| x.as_str()).unwrap_or(&""); - let urlencode_resp = params - .get("encoding-type") - .map(|x| x == "url") - .unwrap_or(false); - let marker = params.get("marker").map(String::as_str); - Ok(handle_list( - garage, - bucket, - delimiter, - max_keys, - prefix, - marker, - urlencode_resp, - ) - .await?) + let q = parse_list_objects_query(bucket, ¶ms)?; + Ok(handle_list(garage, &q).await?) } &Method::POST => { if params.contains_key(&"delete".to_string()) { |