diff options
author | Robin Appelman <robin@icewind.nl> | 2025-04-01 17:29:58 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2025-04-01 17:29:58 +0200 |
commit | 2b0116f0ebf32120d8378df5e5ea19a15df6c618 (patch) | |
tree | 758e9dd304b51a01bc77c9f84534d02160c80f73 /apps/dav | |
parent | b03ffab5f0f39139c71cb2b8c370ca3f3d1ad391 (diff) | |
download | nextcloud-server-2b0116f0ebf32120d8378df5e5ea19a15df6c618.tar.gz nextcloud-server-2b0116f0ebf32120d8378df5e5ea19a15df6c618.zip |
fix: don't have sabre/dav send it's own reponse if we already send the zip responsezip-download-no-sabre-response
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php | 17 |
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; + } + } } |