Skip to content

Commit 2e0d5bd

Browse files
icewind1991skjnldsv
authored andcommitted
add some recrusive detection/prevention
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent b0b4c7e commit 2e0d5bd

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

apps/files_sharing/lib/SharedStorage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use OC\Files\Storage\FailedStorage;
4242
use OC\Files\Storage\Home;
4343
use OC\Files\Storage\Wrapper\PermissionsMask;
44+
use OC\Files\Storage\Wrapper\Wrapper;
4445
use OC\User\NoUserException;
4546
use OCA\Files_External\Config\ExternalMountPoint;
4647
use OCP\Constants;
@@ -410,11 +411,10 @@ public function getCache($path = '', $storage = null) {
410411
return new FailedCache();
411412
}
412413

413-
$this->cache = new Cache(
414+
$this->cache = new \OCA\Files_Sharing\Cache(
414415
$storage,
415416
$sourceRoot,
416-
\OC::$server->get(CacheDependencies::class),
417-
$this->getShare()
417+
\OC::$server->get(DisplayNameCache::class)
418418
);
419419
return $this->cache;
420420
}

lib/private/Files/Storage/Wrapper/Wrapper.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,4 +654,15 @@ public function writeStream(string $path, $stream, int $size = null): int {
654654
public function getDirectoryContent($directory): \Traversable {
655655
return $this->getWrapperStorage()->getDirectoryContent($directory);
656656
}
657+
658+
public function isWrapperOf(IStorage $storage) {
659+
$wrapped = $this->getWrapperStorage();
660+
if ($wrapped === $storage) {
661+
return true;
662+
}
663+
if ($wrapped instanceof Wrapper) {
664+
return $wrapped->isWrapperOf($storage);
665+
}
666+
return false;
667+
}
657668
}

0 commit comments

Comments
 (0)