]> source.dussan.org Git - nextcloud-server.git/commitdiff
Trim mount point before matching in encryption code
authorVincent Petry <vincent@nextcloud.com>
Wed, 1 Jun 2022 12:10:38 +0000 (14:10 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Thu, 2 Jun 2022 12:10:07 +0000 (12:10 +0000)
Often times the mount point has a leading slash.
This fix sanitizes it to make sure matching works.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
lib/private/Encryption/Util.php

index dc878ba8fc133c31085adc8cd2f8043cf36c94d4..bf89ef26f082ccb9c4bdc9214485e8aa9d1c293c 100644 (file)
@@ -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;
                                        }