From 79e6b6a33cd0608943c432e06c0e9a4f93cef660 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 13 Apr 2021 18:09:12 +0300 Subject: [PATCH 1/2] fixes compression method to deflate --- package/src/root/zip.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/src/root/zip.rs b/package/src/root/zip.rs index 46426b9d3e..caddb2b338 100644 --- a/package/src/root/zip.rs +++ b/package/src/root/zip.rs @@ -86,7 +86,7 @@ impl ZipFile { let file = &mut File::create(&path)?; let mut zip = ZipWriter::new(file); let options = FileOptions::default() - .compression_method(zip::CompressionMethod::Stored) + .compression_method(zip::CompressionMethod::Deflated) .unix_permissions(0o755); // Walk through files in directory and write desired ones to the zip file From 7213273f5f92b343e5d5089710a3f512c66846d5 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 13 Apr 2021 21:16:54 +0300 Subject: [PATCH 2/2] used deprecated methods instead --- package/src/root/zip.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/src/root/zip.rs b/package/src/root/zip.rs index caddb2b338..6286b125d0 100644 --- a/package/src/root/zip.rs +++ b/package/src/root/zip.rs @@ -86,7 +86,7 @@ impl ZipFile { let file = &mut File::create(&path)?; let mut zip = ZipWriter::new(file); let options = FileOptions::default() - .compression_method(zip::CompressionMethod::Deflated) + .compression_method(zip::CompressionMethod::Stored) .unix_permissions(0o755); // Walk through files in directory and write desired ones to the zip file @@ -106,7 +106,8 @@ impl ZipFile { // Write file or directory if path.is_file() { tracing::info!("Adding file {:?} as {:?}", path, name); - zip.start_file(name.to_string_lossy(), options)?; + #[allow(deprecated)] + zip.start_file_from_path(name, options)?; let mut f = File::open(path)?; f.read_to_end(&mut buffer)?; @@ -116,7 +117,8 @@ impl ZipFile { // Only if not root Avoids path spec / warning // and mapname conversion failed error on unzip tracing::info!("Adding directory {:?} as {:?}", path, name); - zip.add_directory(name.to_string_lossy(), options)?; + #[allow(deprecated)] + zip.add_directory_from_path(name, options)?; } }