Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes sharing to group ids with characters that are being url encoded #24515

Merged
merged 3 commits into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -191,9 +191,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 @@ -231,7 +231,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]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks groups with a plus as it replaces them with even if it might not be needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try this? Groups containing plusses should suffer the exact same issue.

But I think it reveals a different problem here … with and without this change groups containing plusses are not being offerend in the calendar share dialogue.

Copy link
Member Author

@blizzz blizzz Dec 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i see the issue now.

It only works # because it does not decode into something else. But, as said above, this is a different problem, only unveiled here.

Copy link
Member Author

@blizzz blizzz Dec 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickvergessen I added another commit fixing it. But as said, also without the first commit and the calendar changes, a search for groups containing a plus would end up with

    <?xml version="1.0" encoding="utf-8"?>
    <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
      <s:exception>Sabre\DAV\Exception\NotFound</s:exception>
      <s:message>Principal with name POW+WOW not found</s:message>
    </d:error>

(I have not found a similar piece of code for other types like users or circles, i may know to little about the related dav bits)

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