diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index f2b8924673a61..f20c4e2c0fce3 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -65,6 +65,13 @@ private function splitHost(string $host): array { } public function __construct(array $parameters) { + if (!isset($parameters['host'])) { + throw new \InvalidArgumentException('Invalid configuration, no host provided'); + } + if (!isset($parameters['user'])) { + throw new \InvalidArgumentException('Invalid configuration, no user provided'); + } + // Register sftp:// Stream::register(); @@ -77,7 +84,7 @@ public function __construct(array $parameters) { $this->port = (int)(is_numeric($parsedPort) ? $parsedPort : $parsedHost[1]); if (!isset($parameters['user'])) { - throw new \UnexpectedValueException('no authentication parameters specified'); + throw new \InvalidArgumentException('no authentication parameters specified'); } $this->user = $parameters['user']; @@ -89,7 +96,7 @@ public function __construct(array $parameters) { } if ($this->auth === []) { - throw new \UnexpectedValueException('no authentication parameters specified'); + throw new \InvalidArgumentException('no authentication parameters specified'); } $this->root