Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(federation): allows equal signs in federation id
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl authored and AndyScherzinger committed Jun 1, 2025
commit a8280bcada0b9a6ddb3ea26ba0b94ce5b2dd2a7c
5 changes: 4 additions & 1 deletion lib/private/Federation/CloudIdManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/Federation/CloudIdManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public function cloudIdProvider() {
['[email protected]/cloud/', 'test', 'example.com/cloud', '[email protected]/cloud'],
['[email protected]/cloud/index.php', 'test', 'example.com/cloud', '[email protected]/cloud'],
['[email protected]@example.com', '[email protected]', 'example.com', '[email protected]@example.com'],

// Equal signs are not valid on Nextcloud side, but can be used by other federated OCM compatible servers
['[email protected]', 'test==', 'example.com', '[email protected]'],
['[email protected]', '==', 'example.com', '[email protected]'],
];
}

Expand Down
Loading