]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/themes.ts
replace numbers with typed http status codes (#3409)
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / themes.ts
index 82794656d5553265740c145c111c2899e6d948e5..a726a567bdadbd75bd261796d47a793c63a8c289 100644 (file)
@@ -5,6 +5,7 @@ import { areValidationErrors } from './utils'
 import { isPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
 import { PluginManager } from '../../lib/plugins/plugin-manager'
 import { isSafePath } from '../../helpers/custom-validators/misc'
+import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
 
 const serveThemeCSSValidator = [
   param('themeName').custom(isPluginNameValid).withMessage('Should have a valid theme name'),
@@ -19,11 +20,11 @@ const serveThemeCSSValidator = [
     const theme = PluginManager.Instance.getRegisteredThemeByShortName(req.params.themeName)
 
     if (!theme || theme.version !== req.params.themeVersion) {
-      return res.sendStatus(404)
+      return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
     }
 
     if (theme.css.includes(req.params.staticEndpoint) === false) {
-      return res.sendStatus(404)
+      return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
     }
 
     res.locals.registeredPlugin = theme