]> git.proxmox.com Git - proxmox-backup.git/commitdiff
server/rest: fix type ambiguity
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 29 Mar 2021 10:00:38 +0000 (12:00 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 29 Mar 2021 10:02:30 +0000 (12:02 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/server/rest.rs

index 75a29d49d7a02531e10b006362fbeb0859d50d05..150125ec0e28fcf66209b4a2351ca0e34264b84b 100644 (file)
@@ -315,18 +315,19 @@ async fn get_request_parameters<S: 'static + BuildHasher + Send>(
         }
     }
 
-    let body = req_body
-        .map_err(|err| http_err!(BAD_REQUEST, "Promlems reading request body: {}", err))
-        .try_fold(Vec::new(), |mut acc, chunk| async move {
-            // FIXME: max request body size?
-            if acc.len() + chunk.len() < 64 * 1024 {
-                acc.extend_from_slice(&*chunk);
-                Ok(acc)
-            } else {
-                Err(http_err!(BAD_REQUEST, "Request body too large"))
-            }
-        })
-        .await?;
+    let body = TryStreamExt::map_err(req_body, |err| {
+        http_err!(BAD_REQUEST, "Problems reading request body: {}", err)
+    })
+    .try_fold(Vec::new(), |mut acc, chunk| async move {
+        // FIXME: max request body size?
+        if acc.len() + chunk.len() < 64 * 1024 {
+            acc.extend_from_slice(&*chunk);
+            Ok(acc)
+        } else {
+            Err(http_err!(BAD_REQUEST, "Request body too large"))
+        }
+    })
+    .await?;
 
     let utf8_data =
         std::str::from_utf8(&body).map_err(|err| format_err!("Request body not uft8: {}", err))?;