diff options
Diffstat (limited to 'server/controllers/static.ts')
-rw-r--r-- | server/controllers/static.ts | 18 |
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 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | ||
2 | import cors from 'cors' | 1 | import cors from 'cors' |
3 | import express from 'express' | 2 | import express from 'express' |
3 | import { handleStaticError } from '@server/middlewares' | ||
4 | import { CONFIG } from '../initializers/config' | 4 | import { CONFIG } from '../initializers/config' |
5 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants' | 5 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants' |
6 | 6 | ||
@@ -41,19 +41,3 @@ staticRouter.use( | |||
41 | export { | 41 | export { |
42 | staticRouter | 42 | staticRouter |
43 | } | 43 | } |
44 | |||
45 | // --------------------------------------------------------------------------- | ||
46 | |||
47 | function 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 | } | ||