From 499c3aec4cc129d65436a9eb4b5fcd7900dd6f82 Mon Sep 17 00:00:00 2001 From: DastInDark <2350416+hitenkoku@users.noreply.github.com> Date: Mon, 12 Aug 2024 11:34:50 +0900 Subject: [PATCH] feat(afterfact): applied comment https://github.com/Yamato-Security/hayabusa/pull/1390#pullrequestreview-2231908607 --- src/afterfact.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/afterfact.rs b/src/afterfact.rs index 3b469368e..4992ef9c8 100644 --- a/src/afterfact.rs +++ b/src/afterfact.rs @@ -1860,6 +1860,10 @@ pub fn output_json_str( )) && vec_data.is_empty() { + if matches!(profile, Profile::Details(_)) && val == "-" { + target.push(format!("{}\"{}\": {{}}", " ".repeat(4), key)); + continue; + } let tmp_val: Vec<&str> = val.split(": ").collect(); let output_val = _convert_valid_json_str(&tmp_val, matches!(profile, Profile::AllFieldInfo(_))); @@ -1907,7 +1911,7 @@ pub fn output_json_str( HashMap::new(); let mut children_output_order = vec![]; if detect_info.agg_result.is_some() { - if details_target_stock[0] == "-" { + if details_target_stock.is_empty() || details_target_stock[0] == "-" { output_stock.push(format!("{}\"{}\": {{}}", " ".repeat(4), key)); if jsonl_output_flag { target.push(output_stock.join(""));