fix degrade for pull req #464 (#468)

* fix degrade for pull req #464

* add trim
This commit is contained in:
James / hach1yon
2022-03-27 22:26:42 +09:00
committed by GitHub
parent e372605de6
commit 67cf88cddd
2 changed files with 4 additions and 2 deletions

View File

@@ -116,7 +116,9 @@ impl Message {
if is_exist_event_key {
let hash_value = get_serde_number_to_string(tmp_event_record);
if let Some(hash_value) = hash_value {
let hash_value = hash_value.replace(r"(\\a|\\f|\\t|\\n|\\r|\\v)", " ");
// UnicodeのWhitespace characterをそのままCSVに出力すると見難いので、スペースに変換する。なお、先頭と最後のWhitespace characterは単に削除される。
let hash_value: Vec<&str> = hash_value.split_whitespace().collect();
let hash_value = hash_value.join(" ");
hash_map.insert(full_target_str.to_string(), hash_value);
}
}

View File

@@ -54,7 +54,7 @@ pub fn value_to_string(value: &Value) -> Option<String> {
Value::Null => Option::None,
Value::Bool(b) => Option::Some(b.to_string()),
Value::Number(n) => Option::Some(n.to_string()),
Value::String(s) => Option::Some(s.to_string()),
Value::String(s) => Option::Some(s.trim().to_string()),
Value::Array(_) => Option::None,
Value::Object(_) => Option::None,
}