diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index c455eafbfeebfd23dceece7e48ca6eae2698f99b..61fd7d1b0c30332ad32757eb532bd76d5a48551c 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -345,9 +345,6 @@ 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;
 
 		$fields = array_values($this->propertyMap);
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index f256c0094496d31bc9b2cf7add28499c0202815a..90ab40c6d1b398f3868ae43f15eea5ffc7d0dd66 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -190,9 +190,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();
diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php
index 88193cf5b5f7a481ba82a6f8563636fd4433b5d4..ae66d85f4ca961c35df50da430a85caab6975e9a 100644
--- a/apps/dav/lib/DAV/GroupPrincipalBackend.php
+++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php
@@ -232,7 +232,7 @@ class GroupPrincipalBackend implements BackendInterface {
 							}
 						}
 
-						$carry[] = self::PRINCIPAL_PREFIX . '/' . $gid;
+						$carry[] = self::PRINCIPAL_PREFIX . '/' . urlencode($gid);
 						return $carry;
 					}, []);
 					break;
diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php
index 979eb3913543b1dfd725f316964256609ea09588..9dbbc2f3970fed72022d2c522fb54216313219ce 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