Changing compression method to 'stored' instead of bzip2. (#2111)

This commit is contained in:
David Burkett 2018-12-10 13:20:21 -05:00 committed by Ignotus Peverell
parent b7fe4d6621
commit 0ce8f3e1cd

View file

@ -13,8 +13,7 @@
// limitations under the License. // limitations under the License.
use std::fs::{self, File}; use std::fs::{self, File};
/// Wrappers around the `zip-rs` library to compress and decompress zip /// Wrappers around the `zip-rs` library to compress and decompress zip archives.
/// bzip2 archives.
use std::io; use std::io;
use std::path::Path; use std::path::Path;
use walkdir::WalkDir; use walkdir::WalkDir;
@ -23,8 +22,8 @@ use self::zip_rs::result::{ZipError, ZipResult};
use self::zip_rs::write::FileOptions; use self::zip_rs::write::FileOptions;
use zip as zip_rs; use zip as zip_rs;
/// Compress a source directory recursively into a zip file using the /// Compress a source directory recursively into a zip file.
/// bzip2 format. Permissions are set to 644 by default to avoid any /// Permissions are set to 644 by default to avoid any
/// unwanted execution bits. /// unwanted execution bits.
pub fn compress(src_dir: &Path, dst_file: &File) -> ZipResult<()> { pub fn compress(src_dir: &Path, dst_file: &File) -> ZipResult<()> {
if !Path::new(src_dir).is_dir() { if !Path::new(src_dir).is_dir() {
@ -35,7 +34,7 @@ pub fn compress(src_dir: &Path, dst_file: &File) -> ZipResult<()> {
} }
let options = FileOptions::default() let options = FileOptions::default()
.compression_method(zip_rs::CompressionMethod::Bzip2) .compression_method(zip_rs::CompressionMethod::Stored)
.unix_permissions(0o644); .unix_permissions(0o644);
let mut zip = zip_rs::ZipWriter::new(dst_file); let mut zip = zip_rs::ZipWriter::new(dst_file);