From eba472342834aa5142695b09ec826add512df096 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 17 Sep 2020 17:23:33 +0200 Subject: [PATCH] improve handling of out of space errors for smb Signed-off-by: Robin Appelman --- apps/files_external/lib/Lib/Storage/SMB.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 404aa4e12d..c7e2583f08 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -44,6 +44,7 @@ use Icewind\SMB\Exception\Exception; use Icewind\SMB\Exception\ForbiddenException; use Icewind\SMB\Exception\InvalidArgumentException; use Icewind\SMB\Exception\NotFoundException; +use Icewind\SMB\Exception\OutOfSpaceException; use Icewind\SMB\Exception\TimedOutException; use Icewind\SMB\IFileInfo; use Icewind\SMB\Native\NativeServer; @@ -57,6 +58,7 @@ use OC\Files\Filesystem; use OC\Files\Storage\Common; use OCA\Files_External\Lib\Notify\SMBNotifyHandler; use OCP\Constants; +use OCP\Files\EntityTooLargeException; use OCP\Files\Notify\IChange; use OCP\Files\Notify\IRenameChange; use OCP\Files\Storage\INotifyStorage; @@ -497,6 +499,8 @@ class SMB extends Common implements INotifyStorage { return false; } catch (ForbiddenException $e) { return false; + } catch (OutOfSpaceException $e) { + throw new EntityTooLargeException("not enough available space to create file", 0, $e); } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while opening file']); throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); @@ -538,6 +542,8 @@ class SMB extends Common implements INotifyStorage { return true; } return false; + } catch (OutOfSpaceException $e) { + throw new EntityTooLargeException("not enough available space to create file", 0, $e); } catch (ConnectException $e) { $this->logger->logException($e, ['message' => 'Error while creating file']); throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);