aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Security
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-03-13 18:59:16 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-04-03 10:52:34 +0200
commitea05544213b6d472338684e9c7bae66f68453c58 (patch)
tree809724b54187a4d21fbe967b38b10fc4cb4ca38a /lib/private/Security
parentf974281ac9a086004c7e971f3585ed8aa21d194d (diff)
downloadnextcloud-server-ea05544213b6d472338684e9c7bae66f68453c58.tar.gz
nextcloud-server-ea05544213b6d472338684e9c7bae66f68453c58.zip
Fix return type of methods returning false on error
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Security')
-rw-r--r--lib/private/Security/CertificateManager.php30
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php
index fa26c19ceae..be884654bd0 100644
--- a/lib/private/Security/CertificateManager.php
+++ b/lib/private/Security/CertificateManager.php
@@ -33,6 +33,7 @@ declare(strict_types=1);
namespace OC\Security;
use OC\Files\Filesystem;
+use OC\Files\View;
use OCP\ICertificate;
use OCP\ICertificateManager;
use OCP\IConfig;
@@ -43,24 +44,14 @@ use Psr\Log\LoggerInterface;
* Manage trusted certificates for users
*/
class CertificateManager implements ICertificateManager {
- /**
- * @var \OC\Files\View
- */
- protected $view;
-
- /**
- * @var IConfig
- */
- protected $config;
-
+ protected View $view;
+ protected IConfig $config;
protected LoggerInterface $logger;
-
- /** @var ISecureRandom */
- protected $random;
+ protected ISecureRandom $random;
private ?string $bundlePath = null;
- public function __construct(\OC\Files\View $view,
+ public function __construct(View $view,
IConfig $config,
LoggerInterface $logger,
ISecureRandom $random) {
@@ -233,8 +224,7 @@ class CertificateManager implements ICertificateManager {
/**
* Get the full local path to the certificate bundle
- *
- * @return string
+ * @throws \Exception when getting bundle path fails
*/
public function getAbsoluteBundlePath(): string {
try {
@@ -247,7 +237,10 @@ class CertificateManager implements ICertificateManager {
$this->createCertificateBundle();
}
- $this->bundlePath = $this->view->getLocalFile($this->getCertificateBundle());
+ $this->bundlePath = $this->view->getLocalFile($this->getCertificateBundle()) ?: null;
+ }
+ if ($this->bundlePath === null) {
+ throw new \Exception('Failed to get absolute bundle path');
}
return $this->bundlePath;
} catch (\Exception $e) {
@@ -255,9 +248,6 @@ class CertificateManager implements ICertificateManager {
}
}
- /**
- * @return string
- */
private function getPathToCertificates(): string {
return '/files_external/';
}