aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php14
-rw-r--r--lib/private/legacy/OC_Helper.php13
2 files changed, 22 insertions, 5 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
index 0636a251dec..3e297320d15 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
@@ -283,8 +283,9 @@ class DirectoryTest extends \Test\TestCase {
$storage->expects($this->any())
->method('instanceOfStorage')
->willReturnMap([
- '\OCA\Files_Sharing\SharedStorage' => false,
- '\OC\Files\Storage\Wrapper\Quota' => false,
+ ['\OCA\Files_Sharing\SharedStorage', false],
+ ['\OC\Files\Storage\Wrapper\Quota', false],
+ [\OCA\Files_Sharing\External\Storage::class, false],
]);
$storage->expects($this->once())
@@ -314,6 +315,10 @@ class DirectoryTest extends \Test\TestCase {
->method('getRelativePath')
->willReturn('/foo');
+ $this->info->expects($this->once())
+ ->method('getInternalPath')
+ ->willReturn('/foo');
+
$mountPoint->method('getMountPoint')
->willReturn('/user/files/mymountpoint');
@@ -336,6 +341,7 @@ class DirectoryTest extends \Test\TestCase {
->willReturnMap([
['\OCA\Files_Sharing\SharedStorage', false],
['\OC\Files\Storage\Wrapper\Quota', true],
+ [\OCA\Files_Sharing\External\Storage::class, false],
]);
$storage->expects($this->once())
@@ -358,6 +364,10 @@ class DirectoryTest extends \Test\TestCase {
->method('getMountPoint')
->willReturn($mountPoint);
+ $this->info->expects($this->once())
+ ->method('getInternalPath')
+ ->willReturn('/foo');
+
$mountPoint->method('getMountPoint')
->willReturn('/user/files/mymountpoint');
diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php
index 7db60363ff3..f26257dddeb 100644
--- a/lib/private/legacy/OC_Helper.php
+++ b/lib/private/legacy/OC_Helper.php
@@ -541,10 +541,17 @@ class OC_Helper {
$relative = 0;
}
- /** @var string $ownerId */
+ /*
+ * \OCA\Files_Sharing\External\Storage returns the cloud ID as the owner for the storage.
+ * It is unnecessary to query the user manager for the display name, as it won't have this information.
+ */
+ $isRemoteShare = $storage->instanceOfStorage(\OCA\Files_Sharing\External\Storage::class);
+
$ownerId = $storage->getOwner($path);
+ $hasOwnerId = $ownerId !== false && $ownerId !== null;
$ownerDisplayName = '';
- if ($ownerId) {
+
+ if ($isRemoteShare === false && $hasOwnerId) {
$ownerDisplayName = \OC::$server->getUserManager()->getDisplayName($ownerId) ?? '';
}
@@ -566,7 +573,7 @@ class OC_Helper {
'mountPoint' => trim($mountPoint, '/'),
];
- if ($ownerId && $path === '/') {
+ if ($isRemoteShare === false && $hasOwnerId && $path === '/') {
// If path is root, store this as last known quota usage for this user
\OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string)$relative);
}