From 792bc66a57683f145fd2cff0e966f7ecc0f755f2 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 1 Apr 2026 12:17:35 +0200 Subject: [PATCH] fix(zip): Fix warning when downloading Zip file The HEAD request, create a GET subrequest which is not compatible with the ZIP plugin since the ZIP plugin is directly streaming the content to php://output, so we were sending the content in a HEAD request and creating the ZIP twice and this was creating various warning in logs too. Signed-off-by: Carl Schwan --- apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php index 1807ce1604756..53a81f3b43f87 100644 --- a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php @@ -91,10 +91,11 @@ protected function streamNode(Streamer $streamer, NcNode $node, string $rootPath * It is possible to filter / limit the files that should be downloaded, * either by passing (multiple) `X-NC-Files: the-file` headers * or by setting a `files=JSON_ARRAY_OF_FILES` URL query. - * - * @return false|null */ - public function handleDownload(Request $request, Response $response): ?bool { + public function handleDownload(Request $request, Response $response): ?false { + if ($request->getHeader('X-Sabre-Original-Method') === 'HEAD') { + return null; + } $node = $this->tree->getNodeForPath($request->getPath()); if (!($node instanceof Directory)) { // only handle directories @@ -183,11 +184,12 @@ public function handleDownload(Request $request, Response $response): ?bool { } /** - * Tell sabre/dav not to trigger it's own response sending logic as the handleDownload will have already send the response - * - * @return false|null + * Tell sabre/dav not to trigger its own response sending logic as the handleDownload will have already sent the response */ - public function afterDownload(Request $request, Response $response): ?bool { + public function afterDownload(Request $request, Response $response): ?false { + if ($request->getHeader('X-Sabre-Original-Method') === 'HEAD') { + return null; + } $node = $this->tree->getNodeForPath($request->getPath()); if (!($node instanceof Directory)) { // only handle directories