diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2020-08-31 15:51:16 +0300 |
---|---|---|
committer | Julien Veyssier <eneiluj@posteo.net> | 2020-09-02 15:59:43 +0300 |
commit | 4061ff0c1f1d771840b9a8cb5dbda172e7c71208 (patch) | |
tree | e6860bbcaf53a783ad8e9b900a35f7f485175cd4 /lib/Controller/MatterbridgeSettingsController.php | |
parent | 7c5855b505aac0fa1aad8451bcec49685361b63e (diff) |
check if binary has correct owner and permissions
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'lib/Controller/MatterbridgeSettingsController.php')
-rw-r--r-- | lib/Controller/MatterbridgeSettingsController.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Controller/MatterbridgeSettingsController.php b/lib/Controller/MatterbridgeSettingsController.php index 0c0a8a77e..f1882c783 100644 --- a/lib/Controller/MatterbridgeSettingsController.php +++ b/lib/Controller/MatterbridgeSettingsController.php @@ -27,6 +27,7 @@ namespace OCA\Talk\Controller; use OCA\Talk\MatterbridgeManager; use OCA\Talk\Exceptions\ImpossibleToKillException; +use OCA\Talk\Exceptions\WrongPermissionsException; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; @@ -49,10 +50,16 @@ class MatterbridgeSettingsController extends OCSController { * @return DataResponse */ public function getMatterbridgeVersion(): DataResponse { - $version = $this->bridgeManager->getCurrentVersionFromBinary(); - if ($version === null) { + try { + $version = $this->bridgeManager->getCurrentVersionFromBinary(); + if ($version === null) { + return new DataResponse([ + 'error' => 'binary', + ], Http::STATUS_BAD_REQUEST); + } + } catch (WrongPermissionsException $e) { return new DataResponse([ - 'error' => 'binary', + 'error' => 'binary_permissions', ], Http::STATUS_BAD_REQUEST); } |