aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2025-04-14 10:07:36 -0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-04-23 19:23:27 +0000
commitdc3a1997c2a9ad847b4808cc75d22c52c051efa0 (patch)
tree7c07ffbb6117b1f7d4a98ce34741917e82076163
parentaf0013279e82c5b2852dcaabf0eed2b1f43472b7 (diff)
downloadnextcloud-server-backport/51994/stable29.tar.gz
nextcloud-server-backport/51994/stable29.zip
fix(federation): allows equal signs in federation idbackport/51994/stable29
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/private/Federation/CloudIdManager.php5
-rw-r--r--tests/lib/Federation/CloudIdManagerTest.php4
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php
index 9853aeaa1ac..258f1c86b3d 100644
--- a/lib/private/Federation/CloudIdManager.php
+++ b/lib/private/Federation/CloudIdManager.php
@@ -126,7 +126,10 @@ class CloudIdManager implements ICloudIdManager {
$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)) {
$remote = $this->ensureDefaultProtocol($remote);
diff --git a/tests/lib/Federation/CloudIdManagerTest.php b/tests/lib/Federation/CloudIdManagerTest.php
index 1b9b5bfb971..eb2781459de 100644
--- a/tests/lib/Federation/CloudIdManagerTest.php
+++ b/tests/lib/Federation/CloudIdManagerTest.php
@@ -70,6 +70,10 @@ class CloudIdManagerTest extends TestCase {
['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'],
];
}