Skip to content

Commit

Permalink
fix: Fixed null newParent parameter for Ajax Node/Tag/Folder contro…
Browse files Browse the repository at this point in the history
…llers
  • Loading branch information
ambroisemaupate committed Jun 21, 2024
1 parent eb102ae commit 034e0e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/Rozier/src/AjaxControllers/AjaxFoldersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ protected function updatePosition($parameters, Folder $folder): void
/*
* First, we set the new parent
*/
$parent = null;

if (
!empty($parameters['newParent']) &&
is_numeric($parameters['newParent']) &&
$parameters['newParent'] > 0
) {
/** @var Folder $parent */
Expand Down
6 changes: 5 additions & 1 deletion lib/Rozier/src/AjaxControllers/AjaxNodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ protected function updatePosition($parameters, Node $node): void
*/
protected function parseParentNode(array $parameters): ?Node
{
if (!empty($parameters['newParent']) && $parameters['newParent'] > 0) {
if (
!empty($parameters['newParent']) &&
is_numeric($parameters['newParent']) &&
$parameters['newParent'] > 0
) {
return $this->em()->find(Node::class, (int) $parameters['newParent']);
} elseif (null !== $this->getUser()) {
// If user is jailed in a node, prevent moving nodes out.
Expand Down
3 changes: 1 addition & 2 deletions lib/Rozier/src/AjaxControllers/AjaxTagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,9 @@ protected function updatePosition($parameters, Tag $tag): void
/*
* First, we set the new parent
*/
$parent = null;

if (
!empty($parameters['newParent']) &&
is_numeric($parameters['newParent']) &&
$parameters['newParent'] > 0
) {
$parent = $this->em()
Expand Down

0 comments on commit 034e0e1

Please sign in to comment.