From 745b6970bb4d7b93adee42ce4bc5570cb5189997 Mon Sep 17 00:00:00 2001 From: Lorenz Brun Date: Sat, 23 Sep 2023 01:40:52 +0200 Subject: [PATCH] dav: fix wrong decoding of pluses in URLs 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 --- lib/private/Files/Storage/DAV.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 35add2c606b42..e5bbbb560da72 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -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);