mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-28 23:11:17 -07:00
Fix: handle literal null from crowdsec api alerts (#7088)
Docker CI / Docker Build & Push (push) Has been cancelled
Lint / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Lint / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled
This commit is contained in:
@@ -102,6 +102,11 @@ export default async function crowdsecProxyHandler(req, res) {
|
||||
return res.status(status).json({ error: "Crowdsec API Error", data });
|
||||
}
|
||||
|
||||
// Crowdsec returns a literal null instead of an empty array when nothing matches
|
||||
if (data?.toString().trim() === "null") {
|
||||
return res.status(status).json([]);
|
||||
}
|
||||
|
||||
return res.status(status).send(data);
|
||||
} catch (error) {
|
||||
logger.error("Exception calling Crowdsec API: %s", error.message);
|
||||
|
||||
Reference in New Issue
Block a user