]> 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)
committerVincent Petry <vincent@nextcloud.com>
Wed, 1 Jun 2022 16:10:59 +0000 (18:10 +0200)
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 693e24c472138ea76a017299d40186d229150917..174af2e8b8995ed82af8289e4aa57f3b60ae5a36 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;
                                        }