Skip to content

Commit 6c72438

Browse files
rotdropbackportbot[bot]
authored andcommitted
Use the unjailed-path in OC_Helper::getStorageInfo() for files located in SharedStorage.
The current implementation already switches the storage-backend to $storage->getSourceStorage(). However, it then calls $rootInfo->getInternalPath() which returns the internal path relative to the storage where the share is mounted. This is wrong, we need also to unjail the path. Compare, e.g., with OCA\Files_Sharing\SharedStorage::file_get/put_contents() for the "logic". Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
1 parent 5f94ee1 commit 6c72438

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/private/legacy/OC_Helper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,9 @@ public static function getStorageInfo($path, $rootInfo = null) {
506506
if ($storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) {
507507
$includeExtStorage = false;
508508
$sourceStorage = $storage->getSourceStorage();
509+
$internalPath = $storage->getUnjailedPath($rootInfo->getInternalPath());
510+
} else {
511+
$internalPath = $rootInfo->getInternalPath();
509512
}
510513
if ($includeExtStorage) {
511514
if ($storage->instanceOfStorage('\OC\Files\Storage\Home')
@@ -528,7 +531,7 @@ public static function getStorageInfo($path, $rootInfo = null) {
528531
/** @var \OC\Files\Storage\Wrapper\Quota $storage */
529532
$quota = $sourceStorage->getQuota();
530533
}
531-
$free = $sourceStorage->free_space($rootInfo->getInternalPath());
534+
$free = $sourceStorage->free_space($internalPath);
532535
if ($free >= 0) {
533536
$total = $free + $used;
534537
} else {

0 commit comments

Comments
 (0)