mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +01:00
multipart: fix size result calculation
This commit is contained in:
parent
f073d9029f
commit
982ec7bb2f
@ -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>| {
|
||||
|
Loading…
Reference in New Issue
Block a user