Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public function __construct(
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);
}

/**
Expand Down Expand Up @@ -172,4 +174,19 @@ public function handleDownload(Request $request, Response $response): ?bool {
$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;
}
}
}
Loading