Skip to content

Commit 56eff12

Browse files
committed
Use sabre function directly rather than duplicating it
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent cf4c77e commit 56eff12

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

lib/private/AppFramework/Http/Request.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
use OCP\IRequest;
5151
use OCP\IRequestId;
5252
use OCP\Security\ICrypto;
53+
use function Sabre\HTTP\decodePathSegment;
5354

5455
/**
5556
* Class for accessing variables in the request.
@@ -784,17 +785,7 @@ public function getRawPathInfo(): string {
784785
*/
785786
public function getPathInfo() {
786787
$pathInfo = $this->getRawPathInfo();
787-
// following is taken from \Sabre\HTTP\URLUtil::decodePathSegment
788-
$pathInfo = rawurldecode($pathInfo);
789-
$encoding = mb_detect_encoding($pathInfo, ['UTF-8', 'ISO-8859-1']);
790-
791-
switch ($encoding) {
792-
case 'ISO-8859-1':
793-
$pathInfo = utf8_encode($pathInfo);
794-
}
795-
// end copy
796-
797-
return $pathInfo;
788+
return decodePathSegment($pathInfo);
798789
}
799790

800791
/**

0 commit comments

Comments
 (0)