Skip to content

Commit

Permalink
Use relative paths for --find-links and local registries
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Aug 24, 2024
1 parent 31019ff commit 5021f3f
Show file tree
Hide file tree
Showing 3 changed files with 299 additions and 79 deletions.
6 changes: 4 additions & 2 deletions crates/distribution-types/src/index_url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ impl FromStr for IndexUrl {
type Err = IndexUrlError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
let url = if let Ok(path) = Path::new(s).canonicalize() {
let path = Path::new(s);
let url = if path.exists() {
VerbatimUrl::from_path(path)?
} else {
VerbatimUrl::parse_url(s)?
Expand Down Expand Up @@ -247,7 +248,8 @@ impl FromStr for FlatIndexLocation {
type Err = IndexUrlError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
let url = if let Ok(path) = Path::new(s).canonicalize() {
let path = Path::new(s);
let url = if path.exists() {
VerbatimUrl::from_path(path)?
} else {
VerbatimUrl::parse_url(s)?
Expand Down
Loading

0 comments on commit 5021f3f

Please sign in to comment.