Return 404 if Tor relay does not exist

parent e7826035
......@@ -33,13 +33,17 @@ router.get("/:fingerprint/", (req: Request, res: Response, next: NextFunction) =
.then(x => {
const relayData = x[0];
res.render("tor-relay/show.twig", {
"canonical_url": `/tor-relay/${fingerprint}`,
"title": `Tor relay - ${relayData["nickname"]}`,
"description": `${relayData["nickname"]} is a Tor relay hosted on ${relayData["as"]} ${relayData["as_name"]}.`,
"data": relayData,
"json_data": JSON.stringify(relayData, null, 2),
});
if(relayData === undefined) {
next();
} else {
res.render("tor-relay/show.twig", {
"canonical_url": `/tor-relay/${fingerprint}`,
"title": `Tor relay - ${relayData["nickname"]}`,
"description": `${relayData["nickname"]} is a Tor relay hosted on ${relayData["as"]} ${relayData["as_name"]}.`,
"data": relayData,
"json_data": JSON.stringify(relayData, null, 2),
});
}
})
.catch(next);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment