aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2024-09-09 13:07:14 +0200
committerRobin Appelman <robin@icewind.nl>2024-10-10 15:16:12 +0200
commit3017951d1df2ada5cd51c68781eafae05aa995d5 (patch)
tree5e854e871ff430a19e49edca7b21f7abf7081fb5 /lib/private/Files
parentd537050f19b264f96d86a564770835ae36ab9add (diff)
downloadnextcloud-server-3017951d1df2ada5cd51c68781eafae05aa995d5.tar.gz
nextcloud-server-3017951d1df2ada5cd51c68781eafae05aa995d5.zip
fix: Fix copying or moving from shared groupfolders
When copying or moving between two local storages the source path (on disk) to copy or move from is got from the unjailed path of the source storage. However, if the source storage has more than one jail getting the unjailed path resolves the most external jail, but the source path needs to be got from the most internal jail instead (the one closer to the local storage). This can happen, for example, with a shared groupfolder: in that case there is an external jail for the shared storage, and one internal jail for the groupfolder storage wrapped by the shared storage. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Storage/Local.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index 9e3ec663f03..24969ece454 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -538,11 +538,13 @@ class Local extends \OC\Files\Storage\Common {
public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool {
if ($this->canDoCrossStorageMove($sourceStorage)) {
- if ($sourceStorage->instanceOfStorage(Jail::class)) {
+ // resolve any jailed paths
+ while ($sourceStorage->instanceOfStorage(Jail::class)) {
/**
* @var \OC\Files\Storage\Wrapper\Jail $sourceStorage
*/
$sourceInternalPath = $sourceStorage->getUnjailedPath($sourceInternalPath);
+ $sourceStorage = $sourceStorage->getUnjailedStorage();
}
/**
* @var \OC\Files\Storage\Local $sourceStorage
@@ -556,11 +558,13 @@ class Local extends \OC\Files\Storage\Common {
public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool {
if ($this->canDoCrossStorageMove($sourceStorage)) {
- if ($sourceStorage->instanceOfStorage(Jail::class)) {
+ // resolve any jailed paths
+ while ($sourceStorage->instanceOfStorage(Jail::class)) {
/**
* @var \OC\Files\Storage\Wrapper\Jail $sourceStorage
*/
$sourceInternalPath = $sourceStorage->getUnjailedPath($sourceInternalPath);
+ $sourceStorage = $sourceStorage->getUnjailedStorage();
}
/**
* @var \OC\Files\Storage\Local $sourceStorage