From b71bc1289b997eddde8f843c805324692c262007 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 5 Nov 2018 16:27:43 +0100 Subject: [PATCH] Properly search the root of a shared external storage 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 --- lib/private/Files/Cache/Wrapper/CacheJail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 75df45e257b09..57f58e7d8398f 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -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() . '/'); } /**