mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-25 01:17:36 +00:00
Propagate URL errors in verbatim parsing (#3720)
## Summary Closes https://github.com/astral-sh/uv/issues/3715. ## Test Plan ``` ❯ echo "/../test" | cargo run pip compile - error: Couldn't parse requirement in `-` at position 0 Caused by: path could not be normalized: /../test /../test ^^^^^^^^ ❯ echo "-e /../test" | cargo run pip compile - error: Invalid URL in `-`: `/../test` Caused by: path could not be normalized: /../test Caused by: cannot normalize a relative path beyond the base directory ```
This commit is contained in:
parent
19df1a4372
commit
558f628ef1
9 changed files with 97 additions and 40 deletions
|
|
@ -105,7 +105,8 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
Url::parse(url).map_err(|err| Error::Url(url.clone(), err))?
|
||||
}
|
||||
FileLocation::Path(path) => {
|
||||
let url = Url::from_file_path(path).expect("path is absolute");
|
||||
let url = Url::from_file_path(path)
|
||||
.map_err(|()| Error::RelativePath(path.clone()))?;
|
||||
return self
|
||||
.archive(
|
||||
source,
|
||||
|
|
@ -262,7 +263,8 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
Url::parse(url).map_err(|err| Error::Url(url.clone(), err))?
|
||||
}
|
||||
FileLocation::Path(path) => {
|
||||
let url = Url::from_file_path(path).expect("path is absolute");
|
||||
let url = Url::from_file_path(path)
|
||||
.map_err(|()| Error::RelativePath(path.clone()))?;
|
||||
return self
|
||||
.archive_metadata(
|
||||
source,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue