Skip to content

Commit bb1ad1c

Browse files
authored
Merge pull request #59372 from nextcloud/carl/silent-warning-zip
2 parents 530b635 + 7eb0ba9 commit bb1ad1c

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 9 additions & 7 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
*/
97-
public function handleDownload(Request $request, Response $response): ?bool {
95+
public function handleDownload(Request $request, Response $response): ?false {
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
*/
190-
public function afterDownload(Request $request, Response $response): ?bool {
189+
public function afterDownload(Request $request, Response $response): ?false {
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)