Merge pull request #1306 from cgadski/invalid-unicode-hack

don't error on messagepack values encoding invalid strings

Fixes #1305.
macos-click-through
multisn8 3 years ago committed by GitHub
commit 4c0b5f5e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -380,7 +380,10 @@ fn parse_map(map_value: Value) -> Result<Vec<(Value, Value)>> {
} }
fn parse_string(string_value: Value) -> Result<String> { fn parse_string(string_value: Value) -> Result<String> {
string_value.try_into().map_err(ParseError::String) match string_value {
Value::String(s) => Ok(s.into_str().unwrap_or_else(|| String::from("\u{FFFD}"))),
_ => Err(ParseError::String(string_value)),
}
} }
fn parse_u64(u64_value: Value) -> Result<u64> { fn parse_u64(u64_value: Value) -> Result<u64> {

Loading…
Cancel
Save