mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-24 01:48:00 +00:00
Fix borrowed Cow<'_, [u8]> deserializing as str.
This changes the deserialize implementation for a borrowed Cow<[u8]> to specifically request a byte slice, rather than a borrowed string. The old behavior breaks any program which relies on data being deserialized the same way as it was serialized and uses Cow<[u8]>. In serde_json, it just wouldn't deserialize. In bincode, it deserialized normally unless the bytes were invalid UTF8. Fixes https://github.com/TyOverby/bincode/issues/231.
This commit is contained in:
@@ -188,7 +188,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_str(CowBytesVisitor)
|
||||
deserializer.deserialize_bytes(CowBytesVisitor)
|
||||
}
|
||||
|
||||
pub mod size_hint {
|
||||
|
||||
Reference in New Issue
Block a user