diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index 22b06af386f28..ad94eb5500f46 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -126,7 +126,10 @@ public function resolveCloudId(string $cloudId): ICloudId { $user = substr($id, 0, $lastValidAtPos); $remote = substr($id, $lastValidAtPos + 1); - $this->userManager->validateUserId($user); + // We accept slightly more chars when working with federationId than with a local userId. + // We remove those eventual chars from the UserId before using + // the IUserManager API to confirm its format. + $this->userManager->validateUserId(str_replace('=', '-', $user)); if (!empty($user) && !empty($remote)) { return new CloudId($id, $user, $remote, $this->getDisplayNameFromContact($id)); diff --git a/tests/lib/Federation/CloudIdManagerTest.php b/tests/lib/Federation/CloudIdManagerTest.php index 0db36b0524a23..cd33427714d2e 100644 --- a/tests/lib/Federation/CloudIdManagerTest.php +++ b/tests/lib/Federation/CloudIdManagerTest.php @@ -70,6 +70,10 @@ public function cloudIdProvider() { ['test@example.com/cloud/', 'test', 'example.com/cloud', 'test@example.com/cloud'], ['test@example.com/cloud/index.php', 'test', 'example.com/cloud', 'test@example.com/cloud'], ['test@example.com@example.com', 'test@example.com', 'example.com', 'test@example.com@example.com'], + + // Equal signs are not valid on Nextcloud side, but can be used by other federated OCM compatible servers + ['test==@example.com', 'test==', 'example.com', 'test==@example.com'], + ['==@example.com', '==', 'example.com', '==@example.com'], ]; }