Skip to content

Commit 7ea6ed6

Browse files
authored
Merge pull request #22926 from nextcloud/backport/22915/stable19
[stable19] improve handling of out of space errors for smb
2 parents 3479313 + 67543d7 commit 7ea6ed6

File tree

1 file changed

+6
-0
lines changed
  • apps/files_external/lib/Lib/Storage

1 file changed

+6
-0
lines changed

apps/files_external/lib/Lib/Storage/SMB.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
use Icewind\SMB\Exception\ForbiddenException;
4545
use Icewind\SMB\Exception\InvalidArgumentException;
4646
use Icewind\SMB\Exception\NotFoundException;
47+
use Icewind\SMB\Exception\OutOfSpaceException;
4748
use Icewind\SMB\Exception\TimedOutException;
4849
use Icewind\SMB\IFileInfo;
4950
use Icewind\SMB\Native\NativeServer;
@@ -57,6 +58,7 @@
5758
use OC\Files\Storage\Common;
5859
use OCA\Files_External\Lib\Notify\SMBNotifyHandler;
5960
use OCP\Constants;
61+
use OCP\Files\EntityTooLargeException;
6062
use OCP\Files\Notify\IChange;
6163
use OCP\Files\Notify\IRenameChange;
6264
use OCP\Files\Storage\INotifyStorage;
@@ -497,6 +499,8 @@ public function fopen($path, $mode) {
497499
return false;
498500
} catch (ForbiddenException $e) {
499501
return false;
502+
} catch (OutOfSpaceException $e) {
503+
throw new EntityTooLargeException("not enough available space to create file", 0, $e);
500504
} catch (ConnectException $e) {
501505
$this->logger->logException($e, ['message' => 'Error while opening file']);
502506
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
@@ -538,6 +542,8 @@ public function touch($path, $time = null) {
538542
return true;
539543
}
540544
return false;
545+
} catch (OutOfSpaceException $e) {
546+
throw new EntityTooLargeException("not enough available space to create file", 0, $e);
541547
} catch (ConnectException $e) {
542548
$this->logger->logException($e, ['message' => 'Error while creating file']);
543549
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);

0 commit comments

Comments
 (0)