Skip to content

Commit

Permalink
fix: local version parsing in constraint (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra authored Aug 21, 2023
1 parent 9591c1b commit 5c9f1e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/rattler_conda_types/src/version_spec/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn logical_constraint_parser(input: &str) -> IResult<&str, Constraint, ParseCons
// Take everything that looks like a version and use that to parse the version. Any error means
// no characters were detected that belong to the version.
let (rest, version_str) = take_while1::<_, _, (&str, ErrorKind)>(|c: char| {
c.is_alphanumeric() || "!-_.*".contains(c)
c.is_alphanumeric() || "!-_.*+".contains(c)
})(input)
.map_err(|_| {
nom::Err::Error(ParseConstraintError::InvalidVersion(ParseVersionError {
Expand Down Expand Up @@ -188,7 +188,7 @@ pub(crate) fn constraint_parser(input: &str) -> IResult<&str, Constraint, ParseC
#[cfg(test)]
mod test {
use super::*;
use crate::Version;
use crate::{Version, VersionSpec};
use std::str::FromStr;

#[test]
Expand Down Expand Up @@ -340,4 +340,9 @@ mod test {
assert_eq!(constraint_parser("*"), Ok(("", Constraint::Any)));
assert_eq!(constraint_parser("*.*"), Ok(("", Constraint::Any)));
}

#[test]
fn pixi_issue_278() {
assert!(VersionSpec::from_str("1.8.1+g6b29558").is_ok());
}
}

0 comments on commit 5c9f1e8

Please sign in to comment.