diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2025-04-14 10:07:36 -0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-04-23 19:23:40 +0000 |
commit | c3f431d4fef20d2ddb11f5ff9c0fdf774d4721c2 (patch) | |
tree | efaea7bdcf5028348c03e2ca6cd395f907a34667 | |
parent | f9347f94591c7593e37645cb81cb247bbabe35a0 (diff) | |
download | nextcloud-server-backport/51994/stable30.tar.gz nextcloud-server-backport/51994/stable30.zip |
fix(federation): allows equal signs in federation idbackport/51994/stable30
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r-- | lib/private/Federation/CloudIdManager.php | 5 | ||||
-rw-r--r-- | tests/lib/Federation/CloudIdManagerTest.php | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index 884bbbaa9c6..8f2717b54aa 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -106,7 +106,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 1775c18a5e9..7019cd202db 100644 --- a/tests/lib/Federation/CloudIdManagerTest.php +++ b/tests/lib/Federation/CloudIdManagerTest.php @@ -91,6 +91,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'], ]; } |