From 928d8283fea66b267b4f7df5f24d2f835af4ffe9 Mon Sep 17 00:00:00 2001 From: Christopher Gadzinski Date: Mon, 9 May 2022 00:34:42 +0100 Subject: [PATCH] don't error on messagepack values encoding invalid strings --- src/bridge/events.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bridge/events.rs b/src/bridge/events.rs index 61bf41b..dad59fc 100644 --- a/src/bridge/events.rs +++ b/src/bridge/events.rs @@ -380,7 +380,10 @@ fn parse_map(map_value: Value) -> Result> { } fn parse_string(string_value: Value) -> Result { - string_value.try_into().map_err(ParseError::String) + match string_value { + Value::String(s) => Ok(s.into_str().unwrap_or_else(|| String::from("?"))), + _ => Err(ParseError::String(string_value)) + } } fn parse_u64(u64_value: Value) -> Result {