Respond with a 404 when requested file is not found instead of crashing

This commit is contained in:
Alice Gaudon 2021-03-06 18:17:43 +01:00
parent 6d34829263
commit ebed818824
1 changed files with 2 additions and 0 deletions

View File

@ -32,6 +32,8 @@ export default class GiteaRepoLatestReleaseController extends Controller {
data += c;
});
r.on('end', async () => {
if (r.statusCode === 404) return next(new NotFoundHttpError('file', req.url));
try {
const releases = JSON.parse(data);