Skip to content
Merged
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
Use the unjailed-path in OC_Helper::getStorageInfo() for files locate…
…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 <[email protected]>
  • Loading branch information
rotdrop authored and PVince81 committed Feb 18, 2022
commit c31adf12b97283096c63f40185fa6935c3918a2c
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