From bff9b945c5180ed91a94f4238698f0acccbf3d5f Mon Sep 17 00:00:00 2001 From: Jonas Date: Mon, 27 Apr 2026 17:31:48 +0200 Subject: [PATCH] fix(s3): show S3 error messages in the frontend Improves error messages on move/copy operations when bucket quota exceeded Fixes: #58801 Signed-off-by: Jonas --- apps/dav/lib/Connector/Sabre/Directory.php | 3 ++- lib/private/Files/Storage/Common.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index 135bc8fce7393..3498310205285 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -8,6 +8,7 @@ namespace OCA\DAV\Connector\Sabre; +use Aws\S3\Exception\S3Exception; use OC\Files\Utils\PathHelper; use OC\Files\View; use OCA\DAV\AppInfo\Application; @@ -455,7 +456,7 @@ public function moveInto($targetName, $fullSourcePath, INode $sourceNode) { if (!$renameOkay) { throw new \Sabre\DAV\Exception\Forbidden(''); } - } catch (StorageNotAvailableException $e) { + } catch (StorageNotAvailableException|S3Exception $e) { throw new ServiceUnavailable($e->getMessage(), $e->getCode(), $e); } catch (ForbiddenException $ex) { throw new Forbidden($ex->getMessage(), $ex->getRetry(), $ex); diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 02983ac178cbc..57028958e5457 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -8,6 +8,7 @@ namespace OC\Files\Storage; +use Aws\S3\Exception\S3Exception; use OC\Files\Cache\Cache; use OC\Files\Cache\CacheDependencies; use OC\Files\Cache\Propagator; @@ -563,6 +564,9 @@ public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalP try { $this->writeStream($targetInternalPath, $source); $result = true; + } catch (S3Exception $e) { + Server::get(LoggerInterface::class)->warning('Failed to copy stream to storage', ['exception' => $e]); + throw $e; } catch (\Exception $e) { Server::get(LoggerInterface::class)->warning('Failed to copy stream to storage', ['exception' => $e]); }