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 <vincent@nextcloud.com>
This commit is contained in:
Vincent Petry 2022-06-01 14:10:38 +02:00
parent 4e5ed32025
commit a704bcf97f
No known key found for this signature in database
GPG key ID: E055D6A4D513575C

View 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;
}