summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-04-22 21:26:05 +0200
committerGitHub <noreply@github.com>2022-04-22 21:26:05 +0200
commitb7be8f5c22cfffc29e91ff897a53c840a2c3f754 (patch)
tree410c540ca104041ca37f0c3c3985df32546538cd /lib
parentfb59875071ca260f97aaef4d8842a3f4140429de (diff)
parent54ac585bc506105c9842991b5862a676ea7f23fc (diff)
downloadnextcloud-server-b7be8f5c22cfffc29e91ff897a53c840a2c3f754.tar.gz
nextcloud-server-b7be8f5c22cfffc29e91ff897a53c840a2c3f754.zip
Merge pull request #32076 from nextcloud/cache-storage-info-failed-share
use and cache root storage info if a share can't be resolved
Diffstat (limited to 'lib')
-rw-r--r--lib/private/legacy/OC_Helper.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php
index 68fb4311ef8..0d1903007c2 100644
--- a/lib/private/legacy/OC_Helper.php
+++ b/lib/private/legacy/OC_Helper.php
@@ -48,6 +48,7 @@ use OC\Files\Filesystem;
use OCP\Files\Mount\IMountPoint;
use OCP\ICacheFactory;
use OCP\IUser;
+use Psr\Log\LoggerInterface;
use Symfony\Component\Process\ExecutableFinder;
/**
@@ -518,7 +519,6 @@ class OC_Helper {
$sourceStorage = $storage;
if ($storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) {
$includeExtStorage = false;
- $sourceStorage = $storage->getSourceStorage();
$internalPath = $storage->getUnjailedPath($rootInfo->getInternalPath());
} else {
$internalPath = $rootInfo->getInternalPath();
@@ -544,7 +544,19 @@ class OC_Helper {
/** @var \OC\Files\Storage\Wrapper\Quota $storage */
$quota = $sourceStorage->getQuota();
}
- $free = $sourceStorage->free_space($internalPath);
+ try {
+ $free = $sourceStorage->free_space($internalPath);
+ } catch (\Exception $e) {
+ if ($path === "") {
+ throw $e;
+ }
+ /** @var LoggerInterface $logger */
+ $logger = \OC::$server->get(LoggerInterface::class);
+ $logger->warning("Error while getting quota info, using root quota", ['exception' => $e]);
+ $rootInfo = self::getStorageInfo("");
+ $memcache->set($cacheKey, $rootInfo, 5 * 60);
+ return $rootInfo;
+ }
if ($free >= 0) {
$total = $free + $used;
} else {