diff --git a/Cargo.lock b/Cargo.lock index 444b853..c479f3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -481,7 +481,7 @@ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "jcz" -version = "0.2.3" +version = "0.2.4" dependencies = [ "argon2", "assert_cmd", diff --git a/Cargo.toml b/Cargo.toml index db141f2..f657f55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jcz" -version = "0.2.3" +version = "0.2.4" edition = "2021" authors = ["JCZ Contributors"] description = "Just Compress Zip - A unified compression utility" diff --git a/src/operations/collection.rs b/src/operations/collection.rs index 9f0d165..ce3c1c2 100644 --- a/src/operations/collection.rs +++ b/src/operations/collection.rs @@ -6,6 +6,7 @@ use crate::core::compressor::{Compressor, MultiFileCompressor}; use crate::core::config::{CollectionConfig, CollectionMode, CompressionConfig, TimestampOption}; use crate::core::error::{JcError, JcResult}; use crate::core::types::CompoundFormat; +use crate::operations::encrypt::encrypt_file; use crate::utils::{copy_recursive, create_temp_dir, debug, info, move_file, remove_file_silent}; /// Collect multiple files into a compressed archive @@ -131,6 +132,13 @@ pub fn collect_and_compress( tar_filename }; + // Apply encryption if specified + let final_output = if let Some(ref encryption_method) = collection_config.base.encryption { + encrypt_file(&final_output, encryption_method)? + } else { + final_output + }; + // Move to destination or current directory let destination = collection_config .base