Skip to content

Commit 380472d

Browse files
authored
Merge pull request #22840 from nextcloud/backport/22770/stable19
[stable19] Mitigate encoding issue with user principal uri
2 parents 9e88559 + ac87e46 commit 380472d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/dav/lib/Connector/Sabre/Principal.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ public function getPrincipalByPath($path) {
168168
}
169169

170170
if ($prefix === $this->principalPrefix) {
171-
$user = $this->userManager->get($name);
171+
// Depending on where it is called, it may happen that this function
172+
// is called either with a urlencoded version of the name or with a non-urlencoded one.
173+
// The urldecode function replaces %## and +, both of which are forbidden in usernames.
174+
// Hence there can be no ambiguity here and it is safe to call urldecode on all usernames
175+
$user = $this->userManager->get(urldecode($name));
172176

173177
if ($user !== null) {
174178
return $this->userToPrincipal($user);

0 commit comments

Comments
 (0)