From 0d1a0d88dcc995db5ec4003fa3fbb0444874a69f Mon Sep 17 00:00:00 2001 From: "jacob.wiltse" Date: Wed, 7 Feb 2024 12:59:16 -0500 Subject: [PATCH 1/2] fix: actually skip 404s --- .../src/index/package_database.rs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/crates/rattler_installs_packages/src/index/package_database.rs b/crates/rattler_installs_packages/src/index/package_database.rs index f0d062ea..823b69e4 100644 --- a/crates/rattler_installs_packages/src/index/package_database.rs +++ b/crates/rattler_installs_packages/src/index/package_database.rs @@ -634,14 +634,20 @@ async fn fetch_simple_api(http: &Http, url: Url) -> miette::Result response, + Err(err) => { + if let HttpRequestError::HttpError(err) = &err { + if err.status() == Some(StatusCode::NOT_FOUND) { + return Ok(None); + } + } + return Err(err.into()); + } + }; let content_type = response .headers() From 92bcf0a1336fb93ecedbe76fcf71bac0e12d72bb Mon Sep 17 00:00:00 2001 From: "jacob.wiltse" Date: Wed, 7 Feb 2024 13:13:17 -0500 Subject: [PATCH 2/2] correct test to match expected result --- .../src/index/package_database.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/rattler_installs_packages/src/index/package_database.rs b/crates/rattler_installs_packages/src/index/package_database.rs index 823b69e4..36e00862 100644 --- a/crates/rattler_installs_packages/src/index/package_database.rs +++ b/crates/rattler_installs_packages/src/index/package_database.rs @@ -826,15 +826,8 @@ mod test { .available_artifacts(ArtifactRequest::FromIndex(pytest_name.into())) .await; - // Should fail because pytest is associated with test index - assert!(pytest_result.is_err()); - match pytest_result - .unwrap_err() - .downcast_ref::() - { - Some(HttpRequestError::HttpError(e)) if e.status() == Some(StatusCode::NOT_FOUND) => (), - _ => panic!("unexpected error type"), - }; + // Should not fail because 404s are skipped + assert!(pytest_result.is_ok()); let test_package_result = package_db .available_artifacts(ArtifactRequest::FromIndex(normalized_name))