]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/cache.ts
Check follow constraints when getting a video
[github/Chocobozzz/PeerTube.git] / server / middlewares / cache.ts
index 1e00fc7316aaa674c93b251302e3038de45090dd..8ffe7570098100b25df2a9393b8e78020885f082 100644 (file)
@@ -19,6 +19,7 @@ function cacheRoute (lifetimeArg: string | number) {
           logger.debug('No cached results for route %s.', req.originalUrl)
 
           const sendSave = res.send.bind(res)
+          const redirectSave = res.redirect.bind(res)
 
           res.send = (body) => {
             if (res.statusCode >= 200 && res.statusCode < 400) {
@@ -38,6 +39,12 @@ function cacheRoute (lifetimeArg: string | number) {
             return sendSave(body)
           }
 
+          res.redirect = url => {
+            done()
+
+            return redirectSave(url)
+          }
+
           return next()
         }