diff options
author | Joas Schilling <coding@schilljs.com> | 2017-04-18 18:17:16 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-04-18 18:17:16 +0300 |
commit | 7f0a9f019371f297e49955a1097ba42d9608a2e7 (patch) | |
tree | 7495a63d740be811def26127504a8f7b96281df8 | |
parent | 185751a5a53f16089be38d63a02b9c3c033344cb (diff) |
Fix trailing new line
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Controller/PushController.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Controller/PushController.php b/lib/Controller/PushController.php index c80e679..089428a 100644 --- a/lib/Controller/PushController.php +++ b/lib/Controller/PushController.php @@ -89,9 +89,10 @@ class PushController extends OCSController { return new JSONResponse(['message' => 'INVALID_PUSHTOKEN_HASH'], Http::STATUS_BAD_REQUEST); } - if (strlen($devicePublicKey) !== 450 || - strpos($devicePublicKey, '-----BEGIN PUBLIC KEY-----') !== 0 || - strpos($devicePublicKey, '-----END PUBLIC KEY-----') !== 426) { + if ( + (strlen($devicePublicKey) !== 450 && strpos($devicePublicKey, "\n" . '-----END PUBLIC KEY-----') !== 425) || + (strlen($devicePublicKey) !== 451 && strpos($devicePublicKey, "\n" . '-----END PUBLIC KEY-----' . "\n") !== 425) || + strpos($devicePublicKey, '-----BEGIN PUBLIC KEY-----' . "\n") !== 0) { return new JSONResponse(['message' => 'INVALID_DEVICE_KEY'], Http::STATUS_BAD_REQUEST); } |