Skip to content

Commit

Permalink
Use the unjailed-path in OC_Helper::getStorageInfo() for files locate…
Browse files Browse the repository at this point in the history
…d 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>
  • Loading branch information
rotdrop authored and PVince81 committed Feb 18, 2022
1 parent de9e61a commit c31adf1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,9 @@ public static function getStorageInfo($path, $rootInfo = null) {
if ($storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) {
$includeExtStorage = false;
$sourceStorage = $storage->getSourceStorage();
$internalPath = $storage->getUnjailedPath($rootInfo->getInternalPath());
} else {
$internalPath = $rootInfo->getInternalPath();
}
if ($includeExtStorage) {
if ($storage->instanceOfStorage('\OC\Files\Storage\Home')
Expand All @@ -528,7 +531,7 @@ public static function getStorageInfo($path, $rootInfo = null) {
/** @var \OC\Files\Storage\Wrapper\Quota $storage */
$quota = $sourceStorage->getQuota();
}
$free = $sourceStorage->free_space($rootInfo->getInternalPath());
$free = $sourceStorage->free_space($internalPath);
if ($free >= 0) {
$total = $free + $used;
} else {
Expand Down

0 comments on commit c31adf1

Please sign in to comment.