Skip to content

Commit

Permalink
Properly search the root of a shared external storage
Browse files Browse the repository at this point in the history
Fixes #1020

When an external storage is shared with you in full the root is ''
(empty). This adds an extra check for an empty jail basically.

Because if the jail is on the empty string. It matches all paths.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Nov 5, 2018
1 parent 9ea6573 commit 0277cd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Wrapper/CacheJail.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function formatCacheEntry($entry) {

protected function filterCacheEntry($entry) {
$rootLength = strlen($this->getRoot()) + 1;
return ($entry['path'] === $this->getRoot()) or (substr($entry['path'], 0, $rootLength) === $this->getRoot() . '/');
return $rootLength === 1 || ($entry['path'] === $this->getRoot()) || (substr($entry['path'], 0, $rootLength) === $this->getRoot() . '/');
}

/**
Expand Down

0 comments on commit 0277cd7

Please sign in to comment.