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
  • Loading branch information
lorenz committed Sep 22, 2023
1 parent 7fecdf6 commit f268fb8
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 f268fb8

Please sign in to comment.