Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Fix deserialization of tag !<%21>
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 6, 2023
1 parent 879a57f commit ebb4b7a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/de.rs
Expand Up @@ -1191,9 +1191,12 @@ fn invalid_type(event: &Event, exp: &dyn Expected) -> Error {
}

fn parse_tag(libyaml_tag: &Option<Tag>) -> Option<&str> {
let bytes: &[u8] = libyaml_tag.as_ref()?;
let mut bytes: &[u8] = libyaml_tag.as_ref()?;
if let (b'!', rest) = bytes.split_first()? {
str::from_utf8(rest).ok()
if !rest.is_empty() {
bytes = rest;
}
str::from_utf8(bytes).ok()
} else {
None
}
Expand Down

0 comments on commit ebb4b7a

Please sign in to comment.