Fix data parsing

This commit is contained in:
2026-06-12 16:10:49 +02:00
parent 5dec5e8c0f
commit 90598d8110
+12 -3
View File
@@ -39,12 +39,21 @@ export default class GiteaEngine {
const response = await doFetch(`${this.giteaSearchUrl}?q=${encodeURIComponent(query)}&page=${encodeURIComponent(page)}`, {headers: headers})
context?.sentinel?.(response, name)
const data = await response.json()
return data.map((r) => ({
const response_json = await response.json()
if (response_json.ok != true) {
throw context.engineError(
"Gitea failure",
`${this.name} returned a nok response.`,
{ engine: this.name },
);
}
return response_json.data.map((r) => ({
title: r.full_name,
url: r.html_url,
snippet: r.description ?? "",
source: "Gitea",
source: this.name,
...(r.avatar_url ? { thumbnail: r.avatar_url } : {}),
}));
} catch (e) {