Skip to content

Commit

Permalink
fix: nom parser has been configured incorrectly for parsing user deta…
Browse files Browse the repository at this point in the history
…ils (#32)
  • Loading branch information
purpleclay authored Jun 28, 2023
1 parent 6d83aa9 commit 83d25ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gpg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn parse_gpg_key_details(input: &str) -> IResult<&str, GpgPrivateKey> {
tag("uid"),
count(pair(take_until(":"), tag(":")), 9),
))(i)?;
let (i, uid) = separated_pair(take_until(" "), tag(" "), take_until(":"))(i)?;
let (i, uid) = separated_pair(take_until(" <"), tag(" <"), take_until(">"))(i)?;
let (i, _) = take_until("ssb")(i)?;
let (i, _) = tuple((tag("ssb"), count(pair(take_until(":"), tag(":")), 4)))(i)?;
let (i, ssb) = count(pair(take_until(":"), tag(":")), 3)(i)?;
Expand All @@ -208,7 +208,7 @@ fn parse_gpg_key_details(input: &str) -> IResult<&str, GpgPrivateKey> {
i,
GpgPrivateKey {
user_name: uid.0.into(),
user_email: uid.1[1..uid.1.len() - 1].into(),
user_email: uid.1.into(),
secret_key: GpgKeyDetails {
creation_date: sec[1].0.parse::<i64>().unwrap(),
expiration_date: if sec[2].0.is_empty() {
Expand Down

0 comments on commit 83d25ab

Please sign in to comment.