aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-05-12 18:32:38 +0200
committerRobin Appelman <robin@icewind.nl>2025-05-13 18:29:00 +0200
commit0001c22668f3901dc4ca0dee5709401fb52eaa25 (patch)
tree45e73021d19fe02769b3bee165ce370a2474b83b
parentb9da9416bec65faa56e95716f190cf035b640aeb (diff)
downloadnextcloud-server-0001c22668f3901dc4ca0dee5709401fb52eaa25.tar.gz
nextcloud-server-0001c22668f3901dc4ca0dee5709401fb52eaa25.zip
test: add test for nested cache jail unjailedroot
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheJail.php2
-rw-r--r--tests/lib/Files/Cache/Wrapper/CacheJailTest.php11
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php
index 5c7bd4334f3..24050dce0c9 100644
--- a/lib/private/Files/Cache/Wrapper/CacheJail.php
+++ b/lib/private/Files/Cache/Wrapper/CacheJail.php
@@ -50,7 +50,7 @@ class CacheJail extends CacheWrapper {
*
* @return string
*/
- protected function getGetUnjailedRoot() {
+ public function getGetUnjailedRoot() {
return $this->unjailedRoot;
}
diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
index aed13c41ac0..57024e2eb79 100644
--- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
+++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
@@ -8,6 +8,7 @@
namespace Test\Files\Cache\Wrapper;
use OC\Files\Cache\Wrapper\CacheJail;
+use OC\Files\Cache\Wrapper\CacheWrapper;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
use OC\Files\Storage\Wrapper\Jail;
@@ -252,4 +253,14 @@ class CacheJailTest extends CacheTest {
$storage->getWatcher()->update('bar', ['mimetype' => 'text/plain']);
$this->assertTrue($this->cache->inCache('bar'));
}
+
+ public function testUnJailedRoot(): void {
+ $jail1 = new CacheJail($this->sourceCache, 'foo');
+ $jail2 = new CacheJail($jail1, 'bar');
+ $this->assertEquals('foo/bar', $jail2->getGetUnjailedRoot());
+
+ $middleWrapper = new CacheWrapper($jail1);
+ $jail3 = new CacheJail($middleWrapper, 'bar');
+ $this->assertEquals('foo/bar', $jail3->getGetUnjailedRoot());
+ }
}