From e3c97c7a8ec37b00a5786b5d24231f6cbd963b63 Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Thu, 29 Aug 2024 22:42:05 -0700 Subject: [PATCH] async_zip version bump --- Cargo.lock | 30 ++++++++++++++++++++++++------ Cargo.toml | 2 +- src/main.rs | 4 ++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9b90a81..6175688 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.3.15" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" +checksum = "fec134f64e2bc57411226dfc4e52dec859ddfc7e711fc5e07b612584f000e4aa" dependencies = [ "flate2", "futures-core", @@ -123,14 +123,13 @@ dependencies = [ [[package]] name = "async_zip" -version = "0.0.13" +version = "0.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79eaa2b44cfdce59cfff6cb013c96900635085fe7c28fbcbe926c9e5ad0ddfbc" +checksum = "00b9f7252833d5ed4b00aa9604b563529dd5e11de9c23615de2dcdf91eb87b52" dependencies = [ "async-compression", "crc32fast", - "futures-util", - "log", + "futures-lite", "pin-project", "thiserror", "tokio", @@ -734,6 +733,19 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -1683,6 +1695,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56d80efc4b6721e8be2a10a5df21a30fa0b470f1539e53d8b4e6e75faf938b63" +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.12.3" diff --git a/Cargo.toml b/Cargo.toml index d240410..d8b7d7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" [dependencies] async-bincode = { version = "0.7.0", features = ["tokio"] } async-trait = "0.1.81" -async_zip = { version = "0.0.13", features = [ +async_zip = { version = "0.0.17", features = [ "deflate", "tokio", "tokio-fs", diff --git a/src/main.rs b/src/main.rs index 61f74f9..cb639f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -203,7 +203,7 @@ async fn upload_to_zip( let mut archive = tokio::fs::File::create(&archive_path) .await .map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?; - let mut writer = ZipFileWriter::new(&mut archive); + let mut writer = ZipFileWriter::with_tokio(&mut archive); while let Some(field) = body.next_field().await.unwrap() { let file_name = match field.file_name() { @@ -217,7 +217,7 @@ async fn upload_to_zip( let body_with_io_error = stream.map_err(io::Error::other); let mut body_reader = StreamReader::new(body_with_io_error); - let builder = ZipEntryBuilder::new(file_name, Compression::Deflate); + let builder = ZipEntryBuilder::new(file_name.into(), Compression::Deflate); let mut entry_writer = writer .write_entry_stream(builder) .await