aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/static.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/static.ts')
-rw-r--r--server/controllers/static.ts18
1 files changed, 1 insertions, 17 deletions
diff --git a/server/controllers/static.ts b/server/controllers/static.ts
index 0b5c12b76..33c429eb1 100644
--- a/server/controllers/static.ts
+++ b/server/controllers/static.ts
@@ -1,6 +1,6 @@
1import { HttpStatusCode } from '@shared/models'
2import cors from 'cors' 1import cors from 'cors'
3import express from 'express' 2import express from 'express'
3import { handleStaticError } from '@server/middlewares'
4import { CONFIG } from '../initializers/config' 4import { CONFIG } from '../initializers/config'
5import { HLS_STREAMING_PLAYLIST_DIRECTORY, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants' 5import { HLS_STREAMING_PLAYLIST_DIRECTORY, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants'
6 6
@@ -41,19 +41,3 @@ staticRouter.use(
41export { 41export {
42 staticRouter 42 staticRouter
43} 43}
44
45// ---------------------------------------------------------------------------
46
47function handleStaticError (err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
48 const message = err.message || ''
49
50 if (message.includes('ENOENT')) {
51 return res.fail({
52 status: err.status || HttpStatusCode.INTERNAL_SERVER_ERROR_500,
53 message: err.message,
54 type: err.name
55 })
56 }
57
58 return next(err)
59}