use BookStack\Exports\ExportFormatter;
use BookStack\Exports\ZipExports\ZipExportBuilder;
use BookStack\Http\Controller;
+use BookStack\Permissions\Permission;
use Throwable;
class ChapterExportController extends Controller
protected ChapterQueries $queries,
protected ExportFormatter $exportFormatter,
) {
- $this->middleware('can:content-export');
+ $this->middleware(Permission::ContentExport->middleware());
+ $this->middleware('throttle:exports');
}
/**
$chapter = $this->queries->findVisibleBySlugsOrFail($bookSlug, $chapterSlug);
$zip = $builder->buildForChapter($chapter);
- return $this->download()->streamedFileDirectly($zip, $chapterSlug . '.zip', filesize($zip), true);
+ return $this->download()->streamedFileDirectly($zip, $chapterSlug . '.zip', true);
}
}