Skip to content

Commit

Permalink
fix(prost-types): '+' is not a numeric digit
Browse files Browse the repository at this point in the history
  • Loading branch information
mumbleskates committed Jul 12, 2024
1 parent ee61946 commit f7530f1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions prost-types/src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ fn parse_two_digit_numeric(s: &str) -> Option<(u8, &str)> {
if s.len() < 2 {
return None;
}
if s.starts_with('+') {
return None;
}
let (digits, s) = s.split_at(2);
Some((digits.parse().ok()?, s))
}
Expand Down Expand Up @@ -784,6 +787,11 @@ mod tests {
nanos: 0
}),
);
// Leading '+' in two-digit numbers
assert_eq!(
"19+1-+2-+3T+4:+5:+6Z".parse::<Timestamp>(),
Err(crate::TimestampError::ParseFailure),
)
}

#[test]
Expand Down

0 comments on commit f7530f1

Please sign in to comment.