From 2e6af671ca8c0926367dd1aa23fcaf29f3eb1ed9 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 30 Jun 2022 19:29:47 +0800 Subject: [PATCH] fix: permissions of unzipped files (#84) --- Cargo.lock | 18 ++++++++---------- Cargo.toml | 2 +- src/server.rs | 3 ++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 530000b..98ea18e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -153,8 +153,7 @@ dependencies = [ [[package]] name = "async_io_utilities" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0248112abfeab682c97306bc1e180ee957260107a55a437cedf9a3acca92135e" +source = "git+https://github.com/Majored/rs-async-io-utilities#1aa191aa5ff651526e0ac08691b1932724350229" dependencies = [ "tokio", ] @@ -162,8 +161,7 @@ dependencies = [ [[package]] name = "async_zip" version = "0.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a5c419dca9559f15d04befbf9ff01c39ca16d4c0abd56f60daaf87a386b929" +source = "git+https://github.com/sigoden/rs-async-zip?branch=patch01#3bd0e3ff5151c1fca6eea0de2c4d122eb1ce1f5c" dependencies = [ "async-compression", "async_io_utilities", @@ -523,9 +521,9 @@ dependencies = [ [[package]] name = "either" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" [[package]] name = "encoding_rs" @@ -1834,9 +1832,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" dependencies = [ "itoa", "ryu", @@ -1902,9 +1900,9 @@ checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc88c725d61fc6c3132893370cac4a0200e3fedf5da8331c570664b1987f5ca2" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "socket2" diff --git a/Cargo.toml b/Cargo.toml index 1170c94..e94b4bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" futures = "0.3" base64 = "0.13" -async_zip = "0.0.7" +async_zip = { git = "https://github.com/sigoden/rs-async-zip", branch = "patch01" } async-walkdir = "0.2" headers = "0.3" mime_guess = "2.0" diff --git a/src/server.rs b/src/server.rs index 7c58076..c5c5e69 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1020,7 +1020,8 @@ async fn zip_dir(writer: &mut W, dir: &Path, hidden: &str Some(v) => v, None => continue, }; - let entry_options = EntryOptions::new(filename.to_owned(), Compression::Deflate); + let entry_options = EntryOptions::new(filename.to_owned(), Compression::Deflate) + .unix_permissions(0o644); let mut file = File::open(&entry_path).await?; let mut file_writer = writer.write_entry_stream(entry_options).await?; io::copy(&mut file, &mut file_writer).await?;