Skip to content

Commit d87b9dd

Browse files
georgehrkebackportbot[bot]
authored andcommitted
Mitigate encoding issue with user principal uri
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
1 parent 6ca4627 commit d87b9dd

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
@@ -170,7 +170,11 @@ public function getPrincipalByPath($path) {
170170
}
171171

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

175179
if ($user !== null) {
176180
return $this->userToPrincipal($user);

0 commit comments

Comments
 (0)