aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/oauth.ts2
-rw-r--r--server/middlewares/validators/videos/video-imports.ts2
2 files changed, 2 insertions, 2 deletions
diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts
index 9d0eaa51f..b1149174b 100644
--- a/server/middlewares/oauth.ts
+++ b/server/middlewares/oauth.ts
@@ -48,7 +48,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) {
48function authenticatePromiseIfNeeded (req: express.Request, res: express.Response, authenticateInQuery = false) { 48function authenticatePromiseIfNeeded (req: express.Request, res: express.Response, authenticateInQuery = false) {
49 return new Promise(resolve => { 49 return new Promise(resolve => {
50 // Already authenticated? (or tried to) 50 // Already authenticated? (or tried to)
51 if (res.locals.oauth && res.locals.oauth.token.User) return resolve() 51 if (res.locals.oauth?.token.User) return resolve()
52 52
53 if (res.locals.authenticated === false) return res.sendStatus(401) 53 if (res.locals.authenticated === false) return res.sendStatus(401)
54 54
diff --git a/server/middlewares/validators/videos/video-imports.ts b/server/middlewares/validators/videos/video-imports.ts
index e3d900a9e..d69aff118 100644
--- a/server/middlewares/validators/videos/video-imports.ts
+++ b/server/middlewares/validators/videos/video-imports.ts
@@ -38,7 +38,7 @@ const videoImportAddValidator = getCommonVideoEditAttributes().concat([
38 logger.debug('Checking videoImportAddValidator parameters', { parameters: req.body }) 38 logger.debug('Checking videoImportAddValidator parameters', { parameters: req.body })
39 39
40 const user = res.locals.oauth.token.User 40 const user = res.locals.oauth.token.User
41 const torrentFile = req.files && req.files['torrentfile'] ? req.files['torrentfile'][0] : undefined 41 const torrentFile = req.files?.['torrentfile'] ? req.files['torrentfile'][0] : undefined
42 42
43 if (areValidationErrors(req, res)) return cleanUpReqFiles(req) 43 if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
44 44