mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(zip): Fix warning when downloading Zip file
The HEAD request, create a GET subrequest which is not compatible with the ZIP plugin since the ZIP plugin is directly streaming the content to php://output, so we were sending the content in a HEAD request and creating the ZIP twice and this was creating various warning in logs too. Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
parent
533125defc
commit
7eb0ba9feb
1 changed files with 9 additions and 7 deletions
|
|
@ -91,10 +91,11 @@ class ZipFolderPlugin extends ServerPlugin {
|
|||
* It is possible to filter / limit the files that should be downloaded,
|
||||
* either by passing (multiple) `X-NC-Files: the-file` headers
|
||||
* or by setting a `files=JSON_ARRAY_OF_FILES` URL query.
|
||||
*
|
||||
* @return false|null
|
||||
*/
|
||||
public function handleDownload(Request $request, Response $response): ?bool {
|
||||
public function handleDownload(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
|
||||
|
|
@ -183,11 +184,12 @@ class ZipFolderPlugin extends ServerPlugin {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tell sabre/dav not to trigger it's own response sending logic as the handleDownload will have already send the response
|
||||
*
|
||||
* @return false|null
|
||||
* Tell sabre/dav not to trigger its own response sending logic as the handleDownload will have already sent the response
|
||||
*/
|
||||
public function afterDownload(Request $request, Response $response): ?bool {
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue