Add correct status on not found video

This commit is contained in:
Chocobozzz 2020-01-09 08:50:00 +01:00
parent fb770ff9e6
commit c08579e14f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 4 additions and 1 deletions

View File

@ -37,6 +37,7 @@ export class ClientHtml {
static async getWatchHTMLPage (videoId: string, req: express.Request, res: express.Response) { static async getWatchHTMLPage (videoId: string, req: express.Request, res: express.Response) {
// Let Angular application handle errors // Let Angular application handle errors
if (!validator.isInt(videoId) && !validator.isUUID(videoId, 4)) { if (!validator.isInt(videoId) && !validator.isUUID(videoId, 4)) {
res.status(404)
return ClientHtml.getIndexHTML(req, res) return ClientHtml.getIndexHTML(req, res)
} }
@ -47,7 +48,8 @@ export class ClientHtml {
// Let Angular application handle errors // Let Angular application handle errors
if (!video || video.privacy === VideoPrivacy.PRIVATE || video.privacy === VideoPrivacy.INTERNAL || video.VideoBlacklist) { if (!video || video.privacy === VideoPrivacy.PRIVATE || video.privacy === VideoPrivacy.INTERNAL || video.VideoBlacklist) {
return ClientHtml.getIndexHTML(req, res) res.status(404)
return html
} }
let customHtml = ClientHtml.addTitleTag(html, escapeHTML(video.name)) let customHtml = ClientHtml.addTitleTag(html, escapeHTML(video.name))
@ -77,6 +79,7 @@ export class ClientHtml {
// Let Angular application handle errors // Let Angular application handle errors
if (!entity) { if (!entity) {
res.status(404)
return ClientHtml.getIndexHTML(req, res) return ClientHtml.getIndexHTML(req, res)
} }