Skip to content

Commit

Permalink
fix(prost-types): '+' is not a numeric digit (#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
mumbleskates authored Jul 13, 2024
1 parent ee61946 commit 366c6fb
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 366c6fb

Please sign in to comment.