mirror of
https://github.com/nextcloud/server.git
synced 2026-05-19 16:39:59 -04:00
fix(zip): suppress sabre/dav response if stream was actually sent
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
This commit is contained in:
parent
bb1ad1ca15
commit
d03604a887
1 changed files with 12 additions and 5 deletions
|
|
@ -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 @@ class ZipFolderPlugin extends ServerPlugin {
|
|||
$this->streamNode($streamer, $node, $rootPath);
|
||||
}
|
||||
$streamer->finalize();
|
||||
$this->streamed = true; // archive fully streamed
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -190,12 +198,11 @@ class ZipFolderPlugin extends ServerPlugin {
|
|||
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…
Reference in a new issue