summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-10-01 08:45:26 +0200
committerGitHub <noreply@github.com>2020-10-01 08:45:26 +0200
commitbc633988d8ae4c1c05fc60dcc3e868c0f2aa0fd8 (patch)
treefc08ee4e2bcd5a9880f236ddea9a42c2c8c8e7b7
parent7b3510491ef719650bd72e3919c4f6c5c7c42c88 (diff)
parent16fc3488575af220275aa4c167e9a3cc53a607a4 (diff)
downloadnextcloud-server-bc633988d8ae4c1c05fc60dcc3e868c0f2aa0fd8.tar.gz
nextcloud-server-bc633988d8ae4c1c05fc60dcc3e868c0f2aa0fd8.zip
Merge pull request #22927 from nextcloud/backport/22915/stable18
[stable18] improve handling of out of space errors for smb
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index 6cf7bb7db85..8215dfa4963 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -42,6 +42,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;
@@ -54,6 +55,8 @@ use OC\Cache\CappedMemoryCache;
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;
@@ -460,6 +463,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);
@@ -501,6 +506,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);