Skip to content

Commit fc3bda3

Browse files
committed
Fix CRLF handling in cargo redirect plain version matcher
The plain-version regex was rejecting CRLF line endings because it only allowed spaces/tabs after the version string. Adding \r? before the $ anchor allows the pattern to match lines with Windows line endings, fixing cargo redirect on Windows/core.autocrlf repos.
1 parent 157f32d commit fc3bda3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • crates/socket-patch-core/src/patch/redirect

crates/socket-patch-core/src/patch/redirect/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ fn plan_cargo_toml(
10311031
// swallowed it).
10321032
let c = regex::escape(crate_name);
10331033
let line_re =
1034-
Regex::new(&format!(r#"^(\s*(?:{c}|"{c}")\s*=\s*)"([^"]+)"([ \t]*(?:#.*)?)$"#))
1034+
Regex::new(&format!(r#"^(\s*(?:{c}|"{c}")\s*=\s*)"([^"]+)"([ \t]*(?:#.*)?)\r?$"#))
10351035
.unwrap();
10361036
let Some(m) = line_re.captures(raw) else {
10371037
pending.push(Pending::Refuse(

0 commit comments

Comments
 (0)