From bf24b2484109db90d2dbbbfd1c9cc8931bb5a2c9 Mon Sep 17 00:00:00 2001 From: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:47:43 +0100 Subject: [PATCH] fix: use unjailed source path when moving jailed files Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> --- lib/private/Files/Cache/Wrapper/CacheJail.php | 10 +++++++++- lib/private/Files/Cache/Wrapper/CacheWrapper.php | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index fe597344d395c..59d0faf007845 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -68,6 +68,14 @@ protected function getSourcePath(string $path) { } } + protected function getUnjailedSourcePath(string $path): string { + if ($path === '') { + return $this->getGetUnjailedRoot(); + } else { + return $this->getGetUnjailedRoot() . '/' . ltrim($path, '/'); + } + } + /** * @param string $path * @param null|string $root @@ -189,7 +197,7 @@ public function move($source, $target) { * @return array [$storageId, $internalPath] */ protected function getMoveInfo($path) { - return [$this->getNumericStorageId(), $this->getSourcePath($path)]; + return [$this->getNumericStorageId(), $this->getUnjailedSourcePath($path)]; } /** diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php index ff1953b230486..38becfeefce82 100644 --- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php +++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php @@ -198,7 +198,7 @@ public function move($source, $target) { } protected function getMoveInfo($path) { - /** @var Cache $cache */ + /** @var Cache|CacheJail $cache */ $cache = $this->getCache(); return $cache->getMoveInfo($path); }