aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-04-01 17:29:58 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-04-01 17:26:12 +0000
commit17569defaad6266cb6b62d0c3fd7458a989dec62 (patch)
treef75edf99823e717465d429d0de8666a8366e54f3
parent3afd719d856ccb24f8f7607d2b2fd969057d9851 (diff)
downloadnextcloud-server-backport/51845/stable31.tar.gz
nextcloud-server-backport/51845/stable31.zip
fix: don't have sabre/dav send it's own reponse if we already send the zip responsebackport/51845/stable31
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
index 7e92dd18c83..220988caba0 100644
--- a/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
@@ -55,6 +55,8 @@ class ZipFolderPlugin extends ServerPlugin {
public function initialize(Server $server): void {
$this->server = $server;
$this->server->on('method:GET', $this->handleDownload(...), 100);
+ // low priority to give any other afterMethod:* a chance to fire before we cancel everything
+ $this->server->on('afterMethod:GET', $this->afterDownload(...), 999);
}
/**
@@ -172,4 +174,19 @@ class ZipFolderPlugin extends ServerPlugin {
$streamer->finalize();
return false;
}
+
+ /**
+ * Tell sabre/dav not to trigger it's own response sending logic as the handleDownload will have already send the response
+ *
+ * @return false|null
+ */
+ public function afterDownload(Request $request, Response $response): ?bool {
+ $node = $this->tree->getNodeForPath($request->getPath());
+ if (!($node instanceof Directory)) {
+ // only handle directories
+ return null;
+ } else {
+ return false;
+ }
+ }
}