Skip to content

Commit 4b3c51e

Browse files
authored
Merge pull request #59310 from nextcloud/backport/59252/stable33
[stable33] fix: use unjailed source path when moving jailed files
2 parents 111f803 + 65d8012 commit 4b3c51e

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

lib/private/Files/Cache/Wrapper/CacheJail.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ protected function getSourcePath(string $path) {
6868
}
6969
}
7070

71+
protected function getUnjailedSourcePath(string $path): string {
72+
if ($path === '') {
73+
return $this->getGetUnjailedRoot();
74+
} else {
75+
return $this->getGetUnjailedRoot() . '/' . ltrim($path, '/');
76+
}
77+
}
78+
7179
/**
7280
* @param string $path
7381
* @param null|string $root
@@ -189,7 +197,7 @@ public function move($source, $target) {
189197
* @return array [$storageId, $internalPath]
190198
*/
191199
protected function getMoveInfo($path) {
192-
return [$this->getNumericStorageId(), $this->getSourcePath($path)];
200+
return [$this->getNumericStorageId(), $this->getUnjailedSourcePath($path)];
193201
}
194202

195203
/**

lib/private/Files/Cache/Wrapper/CacheWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function move($source, $target) {
201201
}
202202

203203
protected function getMoveInfo($path) {
204-
/** @var Cache $cache */
204+
/** @var Cache|CacheJail $cache */
205205
$cache = $this->getCache();
206206
return $cache->getMoveInfo($path);
207207
}

0 commit comments

Comments
 (0)