Skip to content

Commit

Permalink
fix: fixed duplicate extrafieldinfo field to ScriptBlockText #1186
Browse files Browse the repository at this point in the history
  • Loading branch information
hitenkoku committed Oct 13, 2023
1 parent 9c6d321 commit f6e1c3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/detections/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,12 @@ pub fn insert(
}
let record_details_info_ref = record_details_info_map.clone();
let profile_all_field_info_prof = record_details_info_ref.get("#AllFieldInfo");
let details_splits: HashSet<&str> = HashSet::from_iter(
sp_removed_details_in_record_trim_newline
.iter()
.map(|x| x.split_once(": ").unwrap_or_default().1),
);
let details_splits: HashSet<&str> =
HashSet::from_iter(sp_removed_details_in_record_trim_newline.iter().map(|x| {
let v = x.split_once(": ").unwrap_or_default().1;
// 末尾のカンマが含まれている場合と含まれていない場合でExtraFieldInfoでの一致判定が変わってしまうため判定用のハッシュセットの末尾のカンマを削除する
v.strip_suffix(',').unwrap_or(v)
}));
let profile_all_field_info = if let Some(all_field_info_val) =
profile_all_field_info_prof
{
Expand Down
4 changes: 2 additions & 2 deletions src/detections/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,11 @@ pub fn create_recordinfos(
convert_field_data(map, field_data_map_key, &key.to_lowercase(), value)
{
let val = remove_sp_char(converted_str, true);
return format!("{key}: {val}").into();
return format!("{key}: {}", val.strip_suffix(',').unwrap_or(&val)).into();
}
}
let val = remove_sp_char(value.into(), true);
format!("{key}: {val}").into()
format!("{key}: {}", val.strip_suffix(',').unwrap_or(&val)).into()
})
.collect()
}
Expand Down

0 comments on commit f6e1c3b

Please sign in to comment.