From 78f3407a20835ad1d6f6c95d791d7f3970935d58 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 28 Jun 2024 15:13:41 +0200 Subject: [PATCH] fix: encode paths that are send to ICAP Signed-off-by: Robin Appelman --- lib/Scanner/ICAP.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Scanner/ICAP.php b/lib/Scanner/ICAP.php index 491d931c..674c325b 100644 --- a/lib/Scanner/ICAP.php +++ b/lib/Scanner/ICAP.php @@ -77,12 +77,13 @@ public function initScanner() { [$path] = explode('.ocTransferId', $path, 2); } $remote = $this->request?->getRemoteAddress(); + $encodedPath = implode("/", array_map("rawurlencode", explode("/", $path))); if ($this->mode === ICAPClient::MODE_REQ_MOD) { $this->icapRequest = $this->icapClient->reqmod($this->service, [ 'Allow' => 204, "X-Client-IP" => $remote, ], [ - "PUT $path HTTP/1.0", + "PUT $encodedPath HTTP/1.0", "Host: nextcloud" ]); } else { @@ -90,7 +91,7 @@ public function initScanner() { 'Allow' => 204, "X-Client-IP" => $remote, ], [ - "GET $path HTTP/1.0", + "GET $encodedPath HTTP/1.0", "Host: nextcloud", ], [ "HTTP/1.0 200 OK",