Skip to content
Draft
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
6 changes: 6 additions & 0 deletions apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ protected function streamNode(Streamer $streamer, NcNode $node, string $rootPath
}
$streamer->addFileFromStream($resource, $filename, $node->getSize(), $mtime);
} elseif ($node instanceof NcFolder) {
$this->logger->info('Creating new archive', ['filename' => $filename]);
$streamer->addEmptyDir($filename, $mtime);
$content = $node->getDirectoryListing();
foreach ($content as $subNode) {
$this->logger->info('Adding new file', ['filename' => $filename, 'file' => $subNode->getPath()]);
$this->streamNode($streamer, $subNode, $rootPath);
}
}
Expand All @@ -101,6 +103,8 @@ public function handleDownload(Request $request, Response $response): ?bool {
return null;
}

$this->logger->info('Going to create an archive for folder', ['path' => $request->getPath()]);

$query = $request->getQueryParameters();

// Get accept header - or if set overwrite with accept GET-param
Expand Down Expand Up @@ -173,9 +177,11 @@ public function handleDownload(Request $request, Response $response): ?bool {
$streamer->sendHeaders($archiveName);
// For full folder downloads we also add the folder itself to the archive
if (empty($files)) {
$this->logger->info('Creating new archive', ['archiveName' => $archiveName, 'path' => $request->getPath()]);
$streamer->addEmptyDir($archiveName);
}
foreach ($content as $node) {
$this->logger->info('Adding a new file in the archive', ['fileName' => $node->getPath(), 'path' => $request->getPath()]);
$this->streamNode($streamer, $node, $rootPath);
}
$streamer->finalize();
Expand Down
Loading