Skip to content

Commit

Permalink
Temp revert
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Aug 10, 2024
1 parent 5cfe80f commit 20e165b
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions crates/pep508-rs/src/verbatim_url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::sync::LazyLock;
use thiserror::Error;
use url::{ParseError, Url};

use uv_fs::{normalize_absolute_path, normalize_url_path, Simplified};
use uv_fs::{normalize_absolute_path, normalize_url_path};

use crate::Pep508Url;

Expand Down Expand Up @@ -36,12 +36,9 @@ impl VerbatimUrl {
pub fn from_path(path: impl AsRef<Path>) -> Result<Self, VerbatimUrlError> {
let path = path.as_ref();

// Normalize the path (and canonicalize it, if possible).
let path = match path.simple_canonicalize() {
Ok(path) => path,
Err(_) => normalize_absolute_path(&path)
.map_err(|err| VerbatimUrlError::Normalization(path.to_path_buf(), err))?,
};
// Normalize the path.
let path = normalize_absolute_path(path)
.map_err(|err| VerbatimUrlError::Normalization(path.to_path_buf(), err))?;

// Extract the fragment, if it exists.
let (path, fragment) = split_fragment(&path);
Expand Down Expand Up @@ -80,12 +77,9 @@ impl VerbatimUrl {
base_dir.as_ref().join(path)
};

// Normalize the path (and canonicalize it, if possible).
let path = match path.simple_canonicalize() {
Ok(path) => path,
Err(_) => normalize_absolute_path(&path)
.map_err(|err| VerbatimUrlError::Normalization(path.to_path_buf(), err))?,
};
// Normalize the path.
let path = normalize_absolute_path(&path)
.map_err(|err| VerbatimUrlError::Normalization(path.clone(), err))?;

// Extract the fragment, if it exists.
let (path, fragment) = split_fragment(&path);
Expand Down Expand Up @@ -113,11 +107,9 @@ impl VerbatimUrl {
return Err(VerbatimUrlError::WorkingDirectory(path.to_path_buf()));
};

// Normalize the path (and canonicalize it, if possible).
let path = match path.simple_canonicalize() {
Ok(path) => path,
Err(_) => normalize_absolute_path(&path)
.map_err(|_| VerbatimUrlError::WorkingDirectory(path))?,
// Normalize the path.
let Ok(path) = normalize_absolute_path(&path) else {
return Err(VerbatimUrlError::WorkingDirectory(path));
};

// Extract the fragment, if it exists.
Expand Down

0 comments on commit 20e165b

Please sign in to comment.