Skip to content
Open
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: 12 additions & 5 deletions apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
}
Loading