Skip to content

fix: read stackId from request body in CardApiController reorder#7948

Closed
guangningsun wants to merge 1 commit into
nextcloud:mainfrom
guangningsun:fix/7933-card-reorder-stackid
Closed

fix: read stackId from request body in CardApiController reorder#7948
guangningsun wants to merge 1 commit into
nextcloud:mainfrom
guangningsun:fix/7933-card-reorder-stackid

Conversation

@guangningsun
Copy link
Copy Markdown

Fix: CardApiController reorder() ignores request body stackId

Issue: #7933

The reorder() method in CardApiController.php receives $stackId as a route parameter, but the actual target stack is passed in the request body. When the API is called with {"stackId": 37, "order": 0}, the card stays in its original stack.

Root Cause:

public function reorder($stackId, $order) {
    $card = $this->cardService->reorder(
        (int)$this->request->getParam('cardId'),
        (int)$stackId,  // <-- Uses route param, not body param
        ...
    );
}

Fix: Read stackId from the request body via php://input when the card needs to move to a different stack.

Testing:

  1. Create a card in stack 36
  2. Call PUT /stacks/36/cards/{id}/reorder with {"stackId": 37, "order": 0}
  3. Card should now be in stack 37 (not stack 36)

Closes #7933

The Deck API reorder endpoint was ignoring the stackId in the request
body because Nextcloud's ApiController maps route parameters to method
parameters with matching names. Since the URL contains {stackId} as a
route parameter (the source stack), that value was taking precedence
over any stackId in the request body.

Now we read stackId from the raw request body (php://input), allowing
cards to be moved between stacks via the REST API.

Fixes: nextcloud#7933
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deck API: CardApiController reorder() ignores request body stackId due to route parameter conflict

2 participants