Ignore 401 errors with multiple indexes (#3292)

## Summary

It seems like Azure might return a 401 when you request a package that
doesn't exist (even with valid credentials)? But I admittedly haven't
tested this. (We already skip 403, and this seems similar?)

Closes https://github.com/astral-sh/uv/issues/3291.
This commit is contained in:
Charlie Marsh 2024-04-28 10:06:43 -04:00 committed by GitHub
parent 748ed66a4d
commit eabefbf8a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -221,7 +221,7 @@ impl RegistryClient {
) -> Result<Vec<(IndexUrl, OwnedArchive<SimpleMetadata>)>, Error> {
let mut it = self.index_urls.indexes().peekable();
if it.peek().is_none() {
return Err(ErrorKind::NoIndex(package_name.as_ref().to_string()).into());
return Err(ErrorKind::NoIndex(package_name.to_string()).into());
}
let mut results = Vec::new();
@ -239,6 +239,7 @@ impl RegistryClient {
ErrorKind::Offline(_) => continue,
ErrorKind::ReqwestError(err) => {
if err.status() == Some(StatusCode::NOT_FOUND)
|| err.status() == Some(StatusCode::UNAUTHORIZED)
|| err.status() == Some(StatusCode::FORBIDDEN)
{
continue;