diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-01-23 18:31:58 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-01-23 18:31:58 +0100 |
commit | 45239549bf2659998dcf9196d86974b0b625912e (patch) | |
tree | 823d324db097400a7b5ae59a03deff54c5fd86ef /middlewares | |
parent | 2cc8ebf134b66047cd639ee7324e1ecfd5c5fd18 (diff) | |
download | PeerTube-45239549bf2659998dcf9196d86974b0b625912e.tar.gz PeerTube-45239549bf2659998dcf9196d86974b0b625912e.tar.zst PeerTube-45239549bf2659998dcf9196d86974b0b625912e.zip |
Finalise the join in a network and add the ability to quit it
Diffstat (limited to 'middlewares')
-rw-r--r-- | middlewares/misc.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/middlewares/misc.js b/middlewares/misc.js index 9755eeff0..c10b0792a 100644 --- a/middlewares/misc.js +++ b/middlewares/misc.js | |||
@@ -28,7 +28,12 @@ | |||
28 | PodsDB.findOne({ url: req.body.signature.url }, function (err, pod) { | 28 | PodsDB.findOne({ url: req.body.signature.url }, function (err, pod) { |
29 | if (err) { | 29 | if (err) { |
30 | logger.error('Cannot get signed url in decryptBody.', { error: err }) | 30 | logger.error('Cannot get signed url in decryptBody.', { error: err }) |
31 | res.sendStatus(500) | 31 | return res.sendStatus(500) |
32 | } | ||
33 | |||
34 | if (pod === null) { | ||
35 | logger.error('Unknown pod %s.', req.body.signature.url) | ||
36 | return res.sendStatus(403) | ||
32 | } | 37 | } |
33 | 38 | ||
34 | logger.debug('Decrypting body from %s.', req.body.signature.url) | 39 | logger.debug('Decrypting body from %s.', req.body.signature.url) |
@@ -43,7 +48,7 @@ | |||
43 | delete req.body.key | 48 | delete req.body.key |
44 | } else { | 49 | } else { |
45 | logger.error('Signature is not okay in decryptBody for %s.', req.body.signature.url) | 50 | logger.error('Signature is not okay in decryptBody for %s.', req.body.signature.url) |
46 | res.sendStatus(500) | 51 | return res.sendStatus(403) |
47 | } | 52 | } |
48 | 53 | ||
49 | next() | 54 | next() |