From 3ce013fa1402b8f7227a350774b4bb5abd40738b Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 2 Dec 2020 20:00:46 +0100 Subject: [PATCH 1/3] fixes sharing to group ids with characters that are being url encoded Signed-off-by: Arthur Schiwon --- apps/dav/lib/CalDAV/CalDavBackend.php | 5 +---- apps/dav/lib/DAV/Sharing/Backend.php | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 20ae236700..a99489f7fd 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -344,10 +344,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); - $principals = array_map(function ($principal) { - return urldecode($principal); - }, $principals); - $principals[]= $principalUri; + $principals[] = $principalUri; $fields = array_values($this->propertyMap); $fields[] = 'a.id'; diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index 2f8fb0c310..c77e90b961 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -107,6 +107,7 @@ class Backend { return; } + $principal[2] = urldecode($principal[2]); if (($principal[1] === 'users' && !$this->userManager->userExists($principal[2])) || ($principal[1] === 'groups' && !$this->groupManager->groupExists($principal[2]))) { // User or group does not exist From b4434833af788588beae0b5104042d46cbc64c47 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 3 Dec 2020 12:35:51 +0100 Subject: [PATCH 2/3] fix finding of groups with decodable chars in their id via DAV Signed-off-by: Arthur Schiwon --- apps/dav/lib/DAV/GroupPrincipalBackend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index 3894431742..2399232ad0 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -219,7 +219,7 @@ class GroupPrincipalBackend implements BackendInterface { } } - $carry[] = self::PRINCIPAL_PREFIX . '/' . $gid; + $carry[] = self::PRINCIPAL_PREFIX . '/' . urlencode($gid); return $carry; }, []); break; From f34202190c4baaec6e4ef313c56a04da082a02bd Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 16 Dec 2020 22:42:57 +0100 Subject: [PATCH 3/3] fixes sharing to group ids /w chars that are being url encoded, carddav Signed-off-by: Arthur Schiwon --- apps/dav/lib/CardDAV/CardDavBackend.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index d517e212c3..a9aa6c5c76 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -191,9 +191,6 @@ class CardDavBackend implements BackendInterface, SyncSupport { $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); - $principals = array_map(function ($principal) { - return urldecode($principal); - }, $principals); $principals[] = $principalUri; $query = $this->db->getQueryBuilder();