aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/lazy-static.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-27 14:38:07 +0200
committerChocobozzz <me@florianbigard.com>2022-07-27 14:38:07 +0200
commiteb7b48ce84e5872d1333edd892f2e6104a18d7f1 (patch)
treefed58d9ef381fb1be4936bc636d0392feaec820c /server/controllers/lazy-static.ts
parente3d6c6434f570f77c0532f86c82f78bcafb399ec (diff)
downloadPeerTube-eb7b48ce84e5872d1333edd892f2e6104a18d7f1.tar.gz
PeerTube-eb7b48ce84e5872d1333edd892f2e6104a18d7f1.tar.zst
PeerTube-eb7b48ce84e5872d1333edd892f2e6104a18d7f1.zip
Prevent logging an error on lazy static 404
Diffstat (limited to 'server/controllers/lazy-static.ts')
-rw-r--r--server/controllers/lazy-static.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/server/controllers/lazy-static.ts b/server/controllers/lazy-static.ts
index 0cab5dcd0..b082e41f6 100644
--- a/server/controllers/lazy-static.ts
+++ b/server/controllers/lazy-static.ts
@@ -7,7 +7,7 @@ import { logger } from '../helpers/logger'
7import { ACTOR_IMAGES_SIZE, LAZY_STATIC_PATHS, STATIC_MAX_AGE } from '../initializers/constants' 7import { ACTOR_IMAGES_SIZE, LAZY_STATIC_PATHS, STATIC_MAX_AGE } from '../initializers/constants'
8import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache' 8import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache'
9import { actorImagePathUnsafeCache, downloadActorImageFromWorker } from '../lib/local-actor' 9import { actorImagePathUnsafeCache, downloadActorImageFromWorker } from '../lib/local-actor'
10import { asyncMiddleware } from '../middlewares' 10import { asyncMiddleware, handleStaticError } from '../middlewares'
11import { ActorImageModel } from '../models/actor/actor-image' 11import { ActorImageModel } from '../models/actor/actor-image'
12 12
13const lazyStaticRouter = express.Router() 13const lazyStaticRouter = express.Router()
@@ -16,27 +16,32 @@ lazyStaticRouter.use(cors())
16 16
17lazyStaticRouter.use( 17lazyStaticRouter.use(
18 LAZY_STATIC_PATHS.AVATARS + ':filename', 18 LAZY_STATIC_PATHS.AVATARS + ':filename',
19 asyncMiddleware(getActorImage) 19 asyncMiddleware(getActorImage),
20 handleStaticError
20) 21)
21 22
22lazyStaticRouter.use( 23lazyStaticRouter.use(
23 LAZY_STATIC_PATHS.BANNERS + ':filename', 24 LAZY_STATIC_PATHS.BANNERS + ':filename',
24 asyncMiddleware(getActorImage) 25 asyncMiddleware(getActorImage),
26 handleStaticError
25) 27)
26 28
27lazyStaticRouter.use( 29lazyStaticRouter.use(
28 LAZY_STATIC_PATHS.PREVIEWS + ':filename', 30 LAZY_STATIC_PATHS.PREVIEWS + ':filename',
29 asyncMiddleware(getPreview) 31 asyncMiddleware(getPreview),
32 handleStaticError
30) 33)
31 34
32lazyStaticRouter.use( 35lazyStaticRouter.use(
33 LAZY_STATIC_PATHS.VIDEO_CAPTIONS + ':filename', 36 LAZY_STATIC_PATHS.VIDEO_CAPTIONS + ':filename',
34 asyncMiddleware(getVideoCaption) 37 asyncMiddleware(getVideoCaption),
38 handleStaticError
35) 39)
36 40
37lazyStaticRouter.use( 41lazyStaticRouter.use(
38 LAZY_STATIC_PATHS.TORRENTS + ':filename', 42 LAZY_STATIC_PATHS.TORRENTS + ':filename',
39 asyncMiddleware(getTorrent) 43 asyncMiddleware(getTorrent),
44 handleStaticError
40) 45)
41 46
42// --------------------------------------------------------------------------- 47// ---------------------------------------------------------------------------