Skip to content

Commit 033d527

Browse files
authored
Merge pull request #31758 from nextcloud/fix/utf8-detection-fix
Use sabre function directly rather than duplicating it
2 parents 8367b02 + 9cfc70d commit 033d527

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

build/psalm-baseline.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2537,7 +2537,8 @@
25372537
<RedundantCondition occurrences="1">
25382538
<code>\is_array($params)</code>
25392539
</RedundantCondition>
2540-
<UndefinedFunction occurrences="1">
2540+
<UndefinedFunction occurrences="2">
2541+
<code>\Sabre\HTTP\decodePath($pathInfo)</code>
25412542
<code>\Sabre\Uri\split($scriptName)</code>
25422543
</UndefinedFunction>
25432544
</file>

lib/private/AppFramework/Http/Request.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -784,17 +784,7 @@ public function getRawPathInfo(): string {
784784
*/
785785
public function getPathInfo() {
786786
$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;
787+
return \Sabre\HTTP\decodePath($pathInfo);
798788
}
799789

800790
/**

0 commit comments

Comments
 (0)