From: Vincent Petry Date: Wed, 1 Jun 2022 12:10:38 +0000 (+0200) Subject: Trim mount point before matching in encryption code X-Git-Tag: v23.0.6rc1~35^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b0b03661c1b16376c755fc1570a5ba32f7071896;p=nextcloud-server.git Trim mount point before matching in encryption code Often times the mount point has a leading slash. This fix sanitizes it to make sure matching works. Signed-off-by: Vincent Petry --- diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index dc878ba8fc1..bf89ef26f08 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -304,7 +304,7 @@ class Util { $storageService = \OC::$server->get(GlobalStoragesService::class); $storages = $storageService->getAllStorages(); foreach ($storages as $storage) { - if (strpos($path, '/files/' . $storage->getMountPoint()) === 0) { + if (strpos($path, '/files/' . ltrim($storage->getMountPoint(), '/')) === 0) { if ($this->isMountPointApplicableToUser($storage, $uid)) { return true; }