diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/reqValidators/pods.js | 4 | ||||
-rw-r--r-- | server/middlewares/reqValidators/utils.js | 6 | ||||
-rw-r--r-- | server/middlewares/secure.js | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/server/middlewares/reqValidators/pods.js b/server/middlewares/reqValidators/pods.js index 45e34c1ab..77449480c 100644 --- a/server/middlewares/reqValidators/pods.js +++ b/server/middlewares/reqValidators/pods.js | |||
@@ -10,13 +10,13 @@ const reqValidatorsPod = { | |||
10 | } | 10 | } |
11 | 11 | ||
12 | function makeFriends (req, res, next) { | 12 | function makeFriends (req, res, next) { |
13 | friends.hasFriends(function (err, has_friends) { | 13 | friends.hasFriends(function (err, hasFriends) { |
14 | if (err) { | 14 | if (err) { |
15 | logger.error('Cannot know if we have friends.', { error: err }) | 15 | logger.error('Cannot know if we have friends.', { error: err }) |
16 | res.sendStatus(500) | 16 | res.sendStatus(500) |
17 | } | 17 | } |
18 | 18 | ||
19 | if (has_friends === true) { | 19 | if (hasFriends === true) { |
20 | // We need to quit our friends before make new ones | 20 | // We need to quit our friends before make new ones |
21 | res.sendStatus(409) | 21 | res.sendStatus(409) |
22 | } else { | 22 | } else { |
diff --git a/server/middlewares/reqValidators/utils.js b/server/middlewares/reqValidators/utils.js index 05675c445..198ed8d26 100644 --- a/server/middlewares/reqValidators/utils.js +++ b/server/middlewares/reqValidators/utils.js | |||
@@ -8,13 +8,13 @@ const reqValidatorsUtils = { | |||
8 | checkErrors: checkErrors | 8 | checkErrors: checkErrors |
9 | } | 9 | } |
10 | 10 | ||
11 | function checkErrors (req, res, next, status_code) { | 11 | function checkErrors (req, res, next, statusCode) { |
12 | if (status_code === undefined) status_code = 400 | 12 | if (statusCode === undefined) statusCode = 400 |
13 | const errors = req.validationErrors() | 13 | const errors = req.validationErrors() |
14 | 14 | ||
15 | if (errors) { | 15 | if (errors) { |
16 | logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors }) | 16 | logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors }) |
17 | return res.status(status_code).send('There have been validation errors: ' + util.inspect(errors)) | 17 | return res.status(statusCode).send('There have been validation errors: ' + util.inspect(errors)) |
18 | } | 18 | } |
19 | 19 | ||
20 | return next() | 20 | return next() |
diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js index 9ecbf5df1..ad7b0fbf7 100644 --- a/server/middlewares/secure.js +++ b/server/middlewares/secure.js | |||
@@ -23,9 +23,9 @@ function decryptBody (req, res, next) { | |||
23 | 23 | ||
24 | logger.debug('Decrypting body from %s.', url) | 24 | logger.debug('Decrypting body from %s.', url) |
25 | 25 | ||
26 | const signature_ok = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature) | 26 | const signatureOk = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature) |
27 | 27 | ||
28 | if (signature_ok === true) { | 28 | if (signatureOk === true) { |
29 | peertubeCrypto.decrypt(req.body.key, req.body.data, function (err, decrypted) { | 29 | peertubeCrypto.decrypt(req.body.key, req.body.data, function (err, decrypted) { |
30 | if (err) { | 30 | if (err) { |
31 | logger.error('Cannot decrypt data.', { error: err }) | 31 | logger.error('Cannot decrypt data.', { error: err }) |