http: Use pinned repo length for per_page unwrap instead of fixed number

This allows us to avoid querying the repo stats and relying on maybe bad
routing tables and take the hardcoded pinned repo array in case of
querying for pinned repos.
This commit is contained in:
Sebastian Martinez
2024-07-29 07:55:54 -03:00
parent f4c773c81b
commit a23c704c24
+4 -1
View File
@@ -64,7 +64,10 @@ async fn project_root_handler(
per_page,
} = qs;
let page = page.unwrap_or(0);
let per_page = per_page.unwrap_or(10);
let per_page = per_page.unwrap_or_else(|| match show {
ProjectQuery::Pinned => ctx.profile.config.web.pinned.repositories.len(),
_ => 10,
});
let storage = &ctx.profile.storage;
let db = &ctx.profile.database()?;
let pinned = &ctx.profile.config.web.pinned;