]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/express-utils.ts
Merge branch 'release/v1.2.0'
[github/Chocobozzz/PeerTube.git] / server / helpers / express-utils.ts
index 162fe2244118a514ce5c38e2461419855881b380..9a72ee96da77d0e4c7d46bea815a16f0c98f12dc 100644 (file)
@@ -7,12 +7,12 @@ import { extname } from 'path'
 import { isArray } from './custom-validators/misc'
 import { UserModel } from '../models/account/user'
 
-function buildNSFWFilter (res: express.Response, paramNSFW?: string) {
+function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {
   if (paramNSFW === 'true') return true
   if (paramNSFW === 'false') return false
   if (paramNSFW === 'both') return undefined
 
-  if (res.locals.oauth) {
+  if (res && res.locals.oauth) {
     const user: UserModel = res.locals.oauth.token.User
 
     // User does not want NSFW videos