From 05df38ead7ef66588ca3d1c4410b94537a3a1a34 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Mon, 21 Aug 2023 17:39:21 +0200 Subject: [PATCH] fix: local version parsing in constraint --- crates/rattler_conda_types/src/version_spec/parse.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/rattler_conda_types/src/version_spec/parse.rs b/crates/rattler_conda_types/src/version_spec/parse.rs index f9cf13228..a3a68dc76 100644 --- a/crates/rattler_conda_types/src/version_spec/parse.rs +++ b/crates/rattler_conda_types/src/version_spec/parse.rs @@ -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 { @@ -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] @@ -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()); + } }