From 28c9358482e27c1e03ccc506c55ba2cacb085f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Tue, 12 May 2026 23:20:06 +0800 Subject: [PATCH] test(notify): cover encoded key target union (#2934) Co-authored-by: houseme --- crates/notify/src/notifier.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/notify/src/notifier.rs b/crates/notify/src/notifier.rs index 7a3bd3419..d904f9437 100644 --- a/crates/notify/src/notifier.rs +++ b/crates/notify/src/notifier.rs @@ -456,6 +456,21 @@ mod tests { assert!(targets.contains(&target_id)); } + #[test] + fn encoded_event_key_matches_raw_and_decoded_rule_targets() { + let raw_target = TargetID::new("raw".to_string(), "webhook".to_string()); + let decoded_target = TargetID::new("decoded".to_string(), "webhook".to_string()); + let mut rules_map = RulesMap::new(); + rules_map.add_rule_config(&[EventName::ObjectCreatedPut], "uploads%2F*.csv".to_string(), raw_target.clone()); + rules_map.add_rule_config(&[EventName::ObjectCreatedPut], "uploads/*.csv".to_string(), decoded_target.clone()); + + let targets = match_event_targets(&rules_map, EventName::ObjectCreatedPut, "uploads%2Freport.csv"); + + assert_eq!(targets.len(), 2); + assert!(targets.contains(&raw_target)); + assert!(targets.contains(&decoded_target)); + } + #[test] fn encoded_event_key_does_not_bypass_suffix_filter() { let target_id = TargetID::new("primary".to_string(), "webhook".to_string());