Skip to content

Commit

Permalink
add some recrusive detection/prevention
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 authored and skjnldsv committed Feb 23, 2024
1 parent b0b4c7e commit 2e0d5bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use OC\Files\Storage\FailedStorage;
use OC\Files\Storage\Home;
use OC\Files\Storage\Wrapper\PermissionsMask;
use OC\Files\Storage\Wrapper\Wrapper;
use OC\User\NoUserException;
use OCA\Files_External\Config\ExternalMountPoint;
use OCP\Constants;
Expand Down Expand Up @@ -410,11 +411,10 @@ public function getCache($path = '', $storage = null) {
return new FailedCache();
}

$this->cache = new Cache(
$this->cache = new \OCA\Files_Sharing\Cache(
$storage,
$sourceRoot,
\OC::$server->get(CacheDependencies::class),
$this->getShare()
\OC::$server->get(DisplayNameCache::class)
);
return $this->cache;
}
Expand Down
11 changes: 11 additions & 0 deletions lib/private/Files/Storage/Wrapper/Wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,15 @@ public function writeStream(string $path, $stream, int $size = null): int {
public function getDirectoryContent($directory): \Traversable {
return $this->getWrapperStorage()->getDirectoryContent($directory);
}

public function isWrapperOf(IStorage $storage) {
$wrapped = $this->getWrapperStorage();
if ($wrapped === $storage) {
return true;
}
if ($wrapped instanceof Wrapper) {
return $wrapped->isWrapperOf($storage);
}
return false;
}
}

0 comments on commit 2e0d5bd

Please sign in to comment.