1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00

multipart: fix size result calculation

This commit is contained in:
Sylvain Kerkour 2019-04-22 15:10:25 +02:00 committed by Douman
parent f073d9029f
commit 982ec7bb2f

View File

@ -23,13 +23,12 @@ pub fn save_file(field: Field) -> impl Future<Item = i64, Error = Error> {
// fs operations are blocking, we have to execute writes
// on threadpool
web::block(move || {
acc += file
.write_all(bytes.as_ref())
.map(|_| acc + bytes.len() as i64)
file.write_all(bytes.as_ref())
.map_err(|e| {
println!("file.write_all failed: {:?}", e);
MultipartError::Payload(error::PayloadError::Io(e))
})?;
acc += bytes.len() as i64;
Ok((file, acc))
})
.map_err(|e: error::BlockingError<MultipartError>| {