if (!FluidbookPublication::hasPermission($id, 'read')) {
abort(401);
}
- return view('fluidbook_publication.delivery.index', ['fluidbook' => FluidbookPublication::where('id', $id)->first()]);
+ $fluidbook = FluidbookPublication::withoutGlobalScopes()->where('id', $id)->first();
+ if ($fluidbook->getPagesNumber() === 0) {
+ abort(404, __('Cette publication ne comporte aucune page'));
+ }
+ return view('fluidbook_publication.delivery.index', ['fluidbook' => $fluidbook]);
}
protected function deliveryThumb($id, $type)
if (null === $fluidbook) {
abort(404, __('Ce fichier est indisponible'));
}
+ if ($fluidbook->getPagesNumber() === 0) {
+ abort(404, __('Cette publication ne comporte aucune page'));
+ }
$path = protected_path('fluidbookpublication/packager/download/' . $file);
if (!file_exists($path)) {
abort(404, __('Le fichier n\'existe pas'));
abort(401, __('Cette version n\'est pas disponible au téléchargement'));
}
+ if ($fluidbook->getPagesNumber() === 0) {
+ abort(404, __('Cette publication ne comporte aucune page'));
+ }
+
// Mark the fluidbook as downloaded when status is ready and user is not an admin
if ($fluidbook->status == 1 && !can('fluidbook-publication:admin')) {
$fluidbook->status = 2;