Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-04-25 17:26:11 +0300
committerGitHub <noreply@github.com>2022-04-25 17:26:11 +0300
commitbce654958805650e69345d401dbeb960b21fc167 (patch)
tree75e9d321fbe5ee2b5a06d1cd6c081cf59f5a233a /lib
parent59bff4746f1d3693c35beb0aee4f5cc848397a0b (diff)
parentb541d0b4154cacfd7a3a2e92978d5744b2d4bdc1 (diff)
Merge pull request #32087 from nextcloud/backport/32076/stable24
[stable24] 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 {