From fad947f7932b3017c36852abb045db208dece3f4 Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Wed, 1 Apr 2026 13:31:40 +0200 Subject: [PATCH] fix(zip): suppress sabre/dav response if stream was actually sent Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- .../dav/lib/Connector/Sabre/ZipFolderPlugin.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php index 53a81f3b43f87..3ccf0a6e24ced 100644 --- a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php +++ b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php @@ -38,6 +38,12 @@ class ZipFolderPlugin extends ServerPlugin { */ private ?Server $server = null; + /** + * Whether handleDownload has fully streamed an archive for the current request. + * Used by afterDownload to decide whether to suppress sabre/dav's own response logic. + */ + private bool $streamed = false; + public function __construct( private Tree $tree, private LoggerInterface $logger, @@ -180,6 +186,8 @@ public function handleDownload(Request $request, Response $response): ?false { $this->streamNode($streamer, $node, $rootPath); } $streamer->finalize(); + $this->streamed = true; // archive fully streamed + return false; } @@ -190,12 +198,11 @@ 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 + + if (!$this->streamed) { return null; - } else { - return false; } + + return false; } }