API v2 row update fails with the documented data format

Open Beginner friendly
#3,261 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, openapi
Domain
api, backend

Research direction

Start by comparing RowOCSController::updateRow() and PublicRowOCSController::updateRow() with createRow(), which the issue says already accepts the documented map format. Check openapi.json for the expected request shape and inspect RowDataInput to understand the failure. Done means both update routes accept the documented map, reject invalid input with HTTP 400, and retain support for the list form.

Written by the indexing model from the issue text.

Description

0. Needs triage bug feature: api
Steps to reproduce

PUT /ocs/v2.php/apps/tables/api/2/views/{v}/rows/{r} (or the public share route) with {"data": {"18": "x"}}, the columnId → value map openapi.json documents.

Expected behavior

The cell is updated, as with createRow() and API v1, which accept the map.

Actual behavior

HTTP 500, logged as "Cannot access offset of type string on string" in RowDataInput. Only the list form [{"columnId": 18, "value": "x"}] works, which is what the web UI sends.

Tables app version

main (2.4.x); also present on the Tables 2.0 pull requests

Database

MariaDB (dev instance); not database-specific unless noted

Additional info

Suggested fix: convert the map in RowOCSController::updateRow() and PublicRowOCSController::updateRow() as createRow() does, and answer 400 for anything else.

Found while reviewing #3178.

Dominant language
JavaScript
Stars
220
Forks
57
Avg merge
1d 13h
Merged PRs (30d)
89

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud/tables

All issues in nextcloud/tables

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.