diff options
author | Alex Auvolat <alex@adnab.me> | 2024-02-07 15:25:49 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2024-02-07 15:32:51 +0100 |
commit | e011941964b1c1e0b90f85014d166d64a83ae8e2 (patch) | |
tree | 5c5cef9af72d48dd7347922341e43f0013380c60 /src/api/s3/post_object.rs | |
parent | 53746b59e525ff5f518ed59d7831b05e2732785d (diff) | |
download | garage-e011941964b1c1e0b90f85014d166d64a83ae8e2.tar.gz garage-e011941964b1c1e0b90f85014d166d64a83ae8e2.zip |
[dep-upgrade-202402] refactor use of BodyStream
Diffstat (limited to 'src/api/s3/post_object.rs')
-rw-r--r-- | src/api/s3/post_object.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/api/s3/post_object.rs b/src/api/s3/post_object.rs index e9732dc4..bca8d6c6 100644 --- a/src/api/s3/post_object.rs +++ b/src/api/s3/post_object.rs @@ -7,8 +7,7 @@ use std::task::{Context, Poll}; use base64::prelude::*; use bytes::Bytes; use chrono::{DateTime, Duration, Utc}; -use futures::{Stream, StreamExt, TryStreamExt}; -use http_body_util::BodyStream; +use futures::{Stream, StreamExt}; use hyper::header::{self, HeaderMap, HeaderName, HeaderValue}; use hyper::{body::Incoming as IncomingBody, Request, Response, StatusCode}; use multer::{Constraints, Multipart, SizeLimit}; @@ -45,10 +44,8 @@ pub async fn handle_post_object( ); let (head, body) = req.into_parts(); - let body_stream = BodyStream::new(body) - .map(|x| x.map(|f| f.into_data().unwrap())) //TODO remove unwrap - .map_err(Error::from); - let mut multipart = Multipart::with_constraints(body_stream, boundary, constraints); + let stream = body_stream::<_, Error>(body); + let mut multipart = Multipart::with_constraints(stream, boundary, constraints); let mut params = HeaderMap::new(); let field = loop { |