Skip to content

Commit

Permalink
Merge pull request #24515 from nextcloud/fix/noid/dav-share-groups-sp…
Browse files Browse the repository at this point in the history
…ecial-chars

fixes sharing to group ids with characters that are being url encoded
  • Loading branch information
ChristophWurst authored Dec 18, 2020
2 parents 7a1b45a + 622d028 commit fbf25e1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
3 changes: 0 additions & 3 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@ public function getCalendarsForUser($principalUri) {
$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);
Expand Down
3 changes: 0 additions & 3 deletions apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,6 @@ public function getAddressBooksForUser($principalUri) {
$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();
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/DAV/GroupPrincipalBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function searchPrincipals($prefixPath, array $searchProperties, $test = '
}
}

$carry[] = self::PRINCIPAL_PREFIX . '/' . $gid;
$carry[] = self::PRINCIPAL_PREFIX . '/' . urlencode($gid);
return $carry;
}, []);
break;
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/DAV/Sharing/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ private function shareWith($shareable, $element) {
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
Expand Down

0 comments on commit fbf25e1

Please sign in to comment.