From 982ec7bb2f249460fe5a0239918df90b7efb367c Mon Sep 17 00:00:00 2001 From: Sylvain Kerkour Date: Mon, 22 Apr 2019 15:10:25 +0200 Subject: [PATCH] multipart: fix size result calculation --- multipart/src/main.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/multipart/src/main.rs b/multipart/src/main.rs index aa3c8b97..da7b929a 100644 --- a/multipart/src/main.rs +++ b/multipart/src/main.rs @@ -23,13 +23,12 @@ pub fn save_file(field: Field) -> impl Future { // 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| {