From c70cb8d57f252095c0842d3b011bbbc4e8ebffb9 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 22 Aug 2019 11:12:43 +0200 Subject: [PATCH] catch auth issues also when php-smbclient is in use Signed-off-by: Arthur Schiwon --- apps/files_external/lib/Lib/Storage/SMB.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index bff2316094..5c8804695b 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -172,6 +172,14 @@ class SMB extends Common implements INotifyStorage { } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while getting file info']); throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + } catch (ForbiddenException $e) { + // with php-smbclient, this exceptions is thrown when the provided password is invalid. + // Possible is also ForbiddenException with a different error code, so we check it. + if($e->getCode() === 1) { + $this->logger->logException($e, ['message' => 'Error while getting file info']); + throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); + } + throw $e; } }