Skip to content

Commit bff9b94

Browse files
committed
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 <jonas@freesources.org>
1 parent 7430bf3 commit bff9b94

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

apps/dav/lib/Connector/Sabre/Directory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace OCA\DAV\Connector\Sabre;
1010

11+
use Aws\S3\Exception\S3Exception;
1112
use OC\Files\Utils\PathHelper;
1213
use OC\Files\View;
1314
use OCA\DAV\AppInfo\Application;
@@ -455,7 +456,7 @@ public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
455456
if (!$renameOkay) {
456457
throw new \Sabre\DAV\Exception\Forbidden('');
457458
}
458-
} catch (StorageNotAvailableException $e) {
459+
} catch (StorageNotAvailableException|S3Exception $e) {
459460
throw new ServiceUnavailable($e->getMessage(), $e->getCode(), $e);
460461
} catch (ForbiddenException $ex) {
461462
throw new Forbidden($ex->getMessage(), $ex->getRetry(), $ex);

lib/private/Files/Storage/Common.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace OC\Files\Storage;
1010

11+
use Aws\S3\Exception\S3Exception;
1112
use OC\Files\Cache\Cache;
1213
use OC\Files\Cache\CacheDependencies;
1314
use OC\Files\Cache\Propagator;
@@ -563,6 +564,9 @@ public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalP
563564
try {
564565
$this->writeStream($targetInternalPath, $source);
565566
$result = true;
567+
} catch (S3Exception $e) {
568+
Server::get(LoggerInterface::class)->warning('Failed to copy stream to storage', ['exception' => $e]);
569+
throw $e;
566570
} catch (\Exception $e) {
567571
Server::get(LoggerInterface::class)->warning('Failed to copy stream to storage', ['exception' => $e]);
568572
}

0 commit comments

Comments
 (0)