From 9132ed8ef1dcc42c67cf5d0fa299d45606a1dfaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 30 Mar 2022 15:07:27 +0200 Subject: [PATCH 1/3] Use sabre function directly rather than duplicating it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/AppFramework/Http/Request.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index f896b825f2d82..4079aa0595bb6 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -50,6 +50,7 @@ use OCP\IRequest; use OCP\IRequestId; use OCP\Security\ICrypto; +use function Sabre\HTTP\decodePathSegment; /** * Class for accessing variables in the request. @@ -784,17 +785,7 @@ public function getRawPathInfo(): string { */ public function getPathInfo() { $pathInfo = $this->getRawPathInfo(); - // following is taken from \Sabre\HTTP\URLUtil::decodePathSegment - $pathInfo = rawurldecode($pathInfo); - $encoding = mb_detect_encoding($pathInfo, ['UTF-8', 'ISO-8859-1']); - - switch ($encoding) { - case 'ISO-8859-1': - $pathInfo = utf8_encode($pathInfo); - } - // end copy - - return $pathInfo; + return decodePathSegment($pathInfo); } /** From de5b7f260f0f149ec9399cfbe651fcf3d382c871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 30 Mar 2022 16:31:54 +0200 Subject: [PATCH 2/3] Trying without the use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/AppFramework/Http/Request.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 4079aa0595bb6..010d889070e19 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -50,7 +50,6 @@ use OCP\IRequest; use OCP\IRequestId; use OCP\Security\ICrypto; -use function Sabre\HTTP\decodePathSegment; /** * Class for accessing variables in the request. @@ -785,7 +784,7 @@ public function getRawPathInfo(): string { */ public function getPathInfo() { $pathInfo = $this->getRawPathInfo(); - return decodePathSegment($pathInfo); + return \Sabre\HTTP\decodePath($pathInfo); } /** From 9cfc70d189eb6532a99bf461e2814d75676111c8 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 25 Apr 2022 16:05:19 +0200 Subject: [PATCH 3/3] Update psalm baseline for Sabre decodePath Signed-off-by: Vincent Petry --- build/psalm-baseline.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index d08312ad78963..4f4e18e1f90b2 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -2537,7 +2537,8 @@ \is_array($params) - + + \Sabre\HTTP\decodePath($pathInfo) \Sabre\Uri\split($scriptName)