Skip to content

Commit

Permalink
Allow dashes and underscores in custom index names
Browse files Browse the repository at this point in the history
Previously, `uv add --index` command threw an error when the index name
included characters like hyphens or underscores.

Closes astral-sh#8315
  • Loading branch information
vinibrsl authored Oct 18, 2024
1 parent c162078 commit 81dd341
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/uv-distribution-types/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl FromStr for Index {
return Err(IndexSourceError::EmptyName);
}

if name.chars().all(char::is_alphanumeric) {
if name.chars().all(|c| c.is_alphanumeric() || c == '-' || c == '_') {
let url = IndexUrl::from_str(url)?;
return Ok(Self {
name: Some(name.to_string()),
Expand Down

0 comments on commit 81dd341

Please sign in to comment.