1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

API: Initial review pass of zip import/export endpoints

Review of #5592
This commit is contained in:
Dan Brown
2025-07-18 09:54:49 +01:00
parent 3626a2265b
commit d15eb129b0
5 changed files with 55 additions and 69 deletions

View File

@@ -65,18 +65,14 @@ class BookExportApiController extends ApiController
return $this->download()->directly($markdown, $book->slug . '.md');
}
/**
* Export a book to a contained ZIP export file.
* @throws NotFoundException
*/
public function exportZip(int $id, ZipExportBuilder $builder)
{
$book = $this->queries->findVisibleByIdOrFail($id);
$bookName= $book->getShortName();
$zip = $builder->buildForBook($book);
return $this->download()->streamedFileDirectly($zip, $bookName . '.zip', filesize($zip), true);
return $this->download()->streamedFileDirectly($zip, $book->slug . '.zip', true);
}
}
}