diff --git a/CHANGELOG.md b/CHANGELOG.md index b24adb0..099e627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased - Fixes issue when getting streams that have multiple filters on single user property +- Fixes issue where upper case file names would not be matched in `parse` # v0.24.0 - BREAKING: the `--context` option is now required. Users need to opt diff --git a/cli/src/commands/parse/emls.rs b/cli/src/commands/parse/emls.rs index a728323..e18d2a5 100644 --- a/cli/src/commands/parse/emls.rs +++ b/cli/src/commands/parse/emls.rs @@ -50,7 +50,7 @@ pub fn parse(client: &Client, args: &ParseEmlArgs, pool: &mut Pool) -> Result<() ensure_uip_user_consents_to_ai_unit_charge(client.base_url())?; } - let eml_paths = get_files_in_directory(directory, "eml")?; + let eml_paths = get_files_in_directory(directory, "eml", true)?; let statistics = Arc::new(Statistics::new()); let _progress = get_progress_bar(eml_paths.len() as u64, &statistics); diff --git a/cli/src/commands/parse/mod.rs b/cli/src/commands/parse/mod.rs index 04379b1..f3b073d 100644 --- a/cli/src/commands/parse/mod.rs +++ b/cli/src/commands/parse/mod.rs @@ -84,11 +84,21 @@ impl Statistics { } } -pub fn get_files_in_directory(directory: &PathBuf, extension: &str) -> Result> { +pub fn get_files_in_directory( + directory: &PathBuf, + target_extension: &str, + case_insensitive: bool, +) -> Result> { Ok(std::fs::read_dir(directory)? .filter_map(|path| { let path = path.ok()?; - if path.path().extension().is_some_and(|msg| msg == extension) { + if path.path().extension().is_some_and(|extension| { + if case_insensitive { + *extension.to_ascii_lowercase() == *target_extension.to_ascii_lowercase() + } else { + extension == target_extension + } + }) { Some(path) } else { None diff --git a/cli/src/commands/parse/msgs.rs b/cli/src/commands/parse/msgs.rs index a20aeee..19f598b 100644 --- a/cli/src/commands/parse/msgs.rs +++ b/cli/src/commands/parse/msgs.rs @@ -230,7 +230,7 @@ pub fn parse(client: &Client, args: &ParseMsgArgs) -> Result<()> { ensure_uip_user_consents_to_ai_unit_charge(client.base_url())?; } - let msg_paths = get_files_in_directory(directory, "msg")?; + let msg_paths = get_files_in_directory(directory, "msg", true)?; let statistics = Arc::new(Statistics::new()); let _progress = get_progress_bar(msg_paths.len() as u64, &statistics); let source = client.get_source(source.clone())?;