diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /server/lib/client-html.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r-- | server/lib/client-html.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 7d1d19588..a1a4a5316 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -22,6 +22,7 @@ import * as Bluebird from 'bluebird' | |||
22 | import { CONFIG } from '../initializers/config' | 22 | import { CONFIG } from '../initializers/config' |
23 | import { logger } from '../helpers/logger' | 23 | import { logger } from '../helpers/logger' |
24 | import { MAccountActor, MChannelActor } from '../types/models' | 24 | import { MAccountActor, MChannelActor } from '../types/models' |
25 | import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes' | ||
25 | 26 | ||
26 | type Tags = { | 27 | type Tags = { |
27 | ogType: string | 28 | ogType: string |
@@ -75,7 +76,7 @@ export class ClientHtml { | |||
75 | static async getWatchHTMLPage (videoId: string, req: express.Request, res: express.Response) { | 76 | static async getWatchHTMLPage (videoId: string, req: express.Request, res: express.Response) { |
76 | // Let Angular application handle errors | 77 | // Let Angular application handle errors |
77 | if (!validator.isInt(videoId) && !validator.isUUID(videoId, 4)) { | 78 | if (!validator.isInt(videoId) && !validator.isUUID(videoId, 4)) { |
78 | res.status(404) | 79 | res.status(HttpStatusCode.NOT_FOUND_404) |
79 | return ClientHtml.getIndexHTML(req, res) | 80 | return ClientHtml.getIndexHTML(req, res) |
80 | } | 81 | } |
81 | 82 | ||
@@ -86,7 +87,7 @@ export class ClientHtml { | |||
86 | 87 | ||
87 | // Let Angular application handle errors | 88 | // Let Angular application handle errors |
88 | if (!video || video.privacy === VideoPrivacy.PRIVATE || video.privacy === VideoPrivacy.INTERNAL || video.VideoBlacklist) { | 89 | if (!video || video.privacy === VideoPrivacy.PRIVATE || video.privacy === VideoPrivacy.INTERNAL || video.VideoBlacklist) { |
89 | res.status(404) | 90 | res.status(HttpStatusCode.NOT_FOUND_404) |
90 | return html | 91 | return html |
91 | } | 92 | } |
92 | 93 | ||
@@ -121,7 +122,7 @@ export class ClientHtml { | |||
121 | static async getWatchPlaylistHTMLPage (videoPlaylistId: string, req: express.Request, res: express.Response) { | 122 | static async getWatchPlaylistHTMLPage (videoPlaylistId: string, req: express.Request, res: express.Response) { |
122 | // Let Angular application handle errors | 123 | // Let Angular application handle errors |
123 | if (!validator.isInt(videoPlaylistId) && !validator.isUUID(videoPlaylistId, 4)) { | 124 | if (!validator.isInt(videoPlaylistId) && !validator.isUUID(videoPlaylistId, 4)) { |
124 | res.status(404) | 125 | res.status(HttpStatusCode.NOT_FOUND_404) |
125 | return ClientHtml.getIndexHTML(req, res) | 126 | return ClientHtml.getIndexHTML(req, res) |
126 | } | 127 | } |
127 | 128 | ||
@@ -132,7 +133,7 @@ export class ClientHtml { | |||
132 | 133 | ||
133 | // Let Angular application handle errors | 134 | // Let Angular application handle errors |
134 | if (!videoPlaylist || videoPlaylist.privacy === VideoPlaylistPrivacy.PRIVATE) { | 135 | if (!videoPlaylist || videoPlaylist.privacy === VideoPlaylistPrivacy.PRIVATE) { |
135 | res.status(404) | 136 | res.status(HttpStatusCode.NOT_FOUND_404) |
136 | return html | 137 | return html |
137 | } | 138 | } |
138 | 139 | ||
@@ -201,7 +202,7 @@ export class ClientHtml { | |||
201 | 202 | ||
202 | // Let Angular application handle errors | 203 | // Let Angular application handle errors |
203 | if (!entity) { | 204 | if (!entity) { |
204 | res.status(404) | 205 | res.status(HttpStatusCode.NOT_FOUND_404) |
205 | return ClientHtml.getIndexHTML(req, res) | 206 | return ClientHtml.getIndexHTML(req, res) |
206 | } | 207 | } |
207 | 208 | ||