1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Fixed issue blocking tags on book update

For #3527
This commit is contained in:
Dan Brown
2022-06-25 13:46:55 +01:00
parent 36f0a68f1b
commit 3ed1ffdbeb
2 changed files with 61 additions and 2 deletions

View File

@ -88,10 +88,11 @@ class BookController extends Controller
public function store(Request $request, string $shelfSlug = null)
{
$this->checkPermission('book-create-all');
$this->validate($request, [
$validated = $this->validate($request, [
'name' => ['required', 'string', 'max:255'],
'description' => ['string', 'max:1000'],
'image' => array_merge(['nullable'], $this->getImageValidationRules()),
'tags' => ['array'],
]);
$bookshelf = null;
@ -100,7 +101,7 @@ class BookController extends Controller
$this->checkOwnablePermission('bookshelf-update', $bookshelf);
}
$book = $this->bookRepo->create($request->all());
$book = $this->bookRepo->create($validated);
if ($bookshelf) {
$bookshelf->appendBook($book);
@ -163,6 +164,7 @@ class BookController extends Controller
'name' => ['required', 'string', 'max:255'],
'description' => ['string', 'max:1000'],
'image' => array_merge(['nullable'], $this->getImageValidationRules()),
'tags' => ['array'],
]);
if ($request->has('image_reset')) {