fix(discovery): preserve provider results across pages

This commit is contained in:
objz committed 2026-08-04 20:55:28 +02:00
1 parent 2f982435f9
commit bf2957e75b
6 files changed
+148 -30

No files matched your search

+5 -5
View File
@@ -302,11 +302,7 @@ pub async fn fetch_versions(
client: &crate::net::HttpClient,
slug_or_id: &str,
) -> Result<Vec<VersionInfo>, crate::net::NetError> {
let url = format!(
"{}/project/{}/version?loaders=[\"fabric\",\"forge\",\"neoforge\",\"quilt\"]",
API_BASE,
url_encode(slug_or_id)
);
let url = versions_url(API_BASE, slug_or_id);
tracing::debug!("Fetching Modrinth versions for project '{}'", slug_or_id);
let versions: Vec<VersionInfo> = client.get_json(&url).await?;
tracing::debug!(
@@ -317,6 +313,10 @@ pub async fn fetch_versions(
Ok(versions)
}
fn versions_url(api_base: &str, slug_or_id: &str) -> String {
format!("{api_base}/project/{}/version", url_encode(slug_or_id))
}
pub async fn fetch_content_versions(
client: &crate::net::HttpClient,
project_id: &str,
+8
View File
@@ -183,6 +183,14 @@ fn primary_file_selection_falls_back_to_first_file() {
);
}
#[test]
fn modpack_versions_are_not_limited_to_hardcoded_loaders() {
assert_eq!(
versions_url("https://example.test/v2", "vanilla pack"),
"https://example.test/v2/project/vanilla%20pack/version"
);
}
#[tokio::test]
async fn content_download_skips_an_existing_filename() {
let directory = tempfile::tempdir().unwrap();