Skip to content

Commit

Permalink
dav: fix wrong decoding of pluses in URLs
Browse files Browse the repository at this point in the history
PHP's urldecode function does not decode URLs according to RFC 3986, but
according to the HTML 4.01 query parameter
encoding. This results in pluses being wrongly decoded to spaces even
though they should not be decoded at all.

Use rawurldecode instead, which follows RFC 3986 properly.

This fixes an issue where files on DAV shares containing pluses were
incorrectly decoded to spaces.

Fixes: #15849
Signed-off-by: Lorenz Brun <lorenz@brun.one>
  • Loading branch information
lorenz authored and susnux committed Feb 3, 2024
1 parent d029575 commit 745b697
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/DAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ public function getDirectoryContent($directory): \Traversable {
}

foreach ($responses as $file => $response) {
$file = urldecode($file);
$file = rawurldecode($file);
$file = substr($file, strlen($this->root));
$file = $this->cleanPath($file);
$this->statCache->set($file, $response);
Expand Down

0 comments on commit 745b697

Please sign in to comment.