Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public function testGetQuotaInfoUnlimited(): void {
->willReturnMap([
['\OCA\Files_Sharing\SharedStorage', false],
['\OC\Files\Storage\Wrapper\Quota', false],
[\OCA\Files_Sharing\External\Storage::class, false],
]);

$storage->expects($this->once())
Expand Down Expand Up @@ -341,6 +342,7 @@ public function testGetQuotaInfoSpecific(): void {
->willReturnMap([
['\OCA\Files_Sharing\SharedStorage', false],
['\OC\Files\Storage\Wrapper\Quota', true],
[\OCA\Files_Sharing\External\Storage::class, false],
]);

$storage->expects($this->once())
Expand Down
11 changes: 9 additions & 2 deletions lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,16 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin
$relative = 0;
}

/*
* \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);
$ownerDisplayName = '';
if ($ownerId !== false) {

if ($isRemoteShare === false && $ownerId !== false) {
$ownerDisplayName = \OC::$server->getUserManager()->getDisplayName($ownerId) ?? '';
}

Expand All @@ -565,7 +572,7 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin
'mountPoint' => trim($mountPoint, '/'),
];

if ($ownerId && $path === '/') {
if ($isRemoteShare === false && $ownerId !== false && $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);
}
Expand Down
Loading