Skip to content

Commit faa4ee1

Browse files
authored
Merge pull request #59384 from nextcloud/backport/59372/stable32
[stable32] fix(zip): Fix warning when downloading Zip file
2 parents 795a7b5 + 82bd176 commit faa4ee1

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ protected function streamNode(Streamer $streamer, NcNode $node, string $rootPath
9191
* It is possible to filter / limit the files that should be downloaded,
9292
* either by passing (multiple) `X-NC-Files: the-file` headers
9393
* or by setting a `files=JSON_ARRAY_OF_FILES` URL query.
94-
*
95-
* @return false|null
9694
*/
9795
public function handleDownload(Request $request, Response $response): ?bool {
96+
if ($request->getHeader('X-Sabre-Original-Method') === 'HEAD') {
97+
return null;
98+
}
9899
$node = $this->tree->getNodeForPath($request->getPath());
99100
if (!($node instanceof Directory)) {
100101
// only handle directories
@@ -183,11 +184,12 @@ public function handleDownload(Request $request, Response $response): ?bool {
183184
}
184185

185186
/**
186-
* Tell sabre/dav not to trigger it's own response sending logic as the handleDownload will have already send the response
187-
*
188-
* @return false|null
187+
* Tell sabre/dav not to trigger its own response sending logic as the handleDownload will have already sent the response
189188
*/
190189
public function afterDownload(Request $request, Response $response): ?bool {
190+
if ($request->getHeader('X-Sabre-Original-Method') === 'HEAD') {
191+
return null;
192+
}
191193
$node = $this->tree->getNodeForPath($request->getPath());
192194
if (!($node instanceof Directory)) {
193195
// only handle directories

0 commit comments

Comments
 (0)