Deprecated `columns` payload on PUT /api/1/views/{viewId} always returns 500
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start in lib/Model/ViewUpdateInput.php around lines 90-113, where the deprecated columns branch calls json_encode() and passes the resulting string to ColumnSettings::createViewSettingsFromInputArray() in lib/Model/ColumnSettings.php, which expects an array. Reproduce with the curl PUT in the issue, then check whether the ViewColumnInformation list needs normalising to plain arrays. Done when that request updates the view's columns instead of returning 500, and the new format still works.
Written by the indexing model from the issue text.
Description
Steps to reproduce
PUT /index.php/apps/tables/api/1/views/{viewId} with the deprecated columns payload, i.e. a plain list of column ids and no columnSettings key:
curl -u user:pass -H 'OCS-APIRequest: true' -H 'Content-Type: application/json' \
-X PUT 'http://localhost/index.php/apps/tables/api/1/views/357' \
-d '{"data":{"columns":[1142,1143,1144,1145]}}'
Expected behavior
The view's columns are updated, since columns is documented as the deprecated-but-supported form — ViewUpdateInput::fromInputArray() logs The old columns format is deprecated. Please use the new format with columnId and order properties. and then converts it. Failing that, a 400 Bad Request naming the problem.
Actual behavior
500 Internal Server Error, with an HTML error page rather than a JSON body. nextcloud.log:
OCA\Tables\Model\ColumnSettings::createViewSettingsFromInputArray(): Argument #1 ($inputColumnSettings)
must be of type array, string given, called in lib/Model/ViewUpdateInput.php on line 113
in file 'lib/Model/ColumnSettings.php' line 63
The conversion branch builds a ViewColumnInformation[] and then JSON-encodes it into a string (lib/Model/ViewUpdateInput.php:92-103):
$value = [];
foreach ($data['columns'] as $order => $columnId) {
$value[] = new ViewColumnInformation($columnId, order: $order);
}
$value = json_encode($value); // <- string
$data['columnSettings'] = $value;
and line 113 passes that string straight into a parameter typed array:
columnSettings: isset($data['columnSettings']) ? ColumnSettings::createViewSettingsFromInputArray($data['columnSettings'], $columnsMap) : null,
transformJsonToArrayInPayload(), which would decode a JSON string back into an array, runs at line 90 — before the string is produced — so it never sees this value. The deprecated path therefore cannot succeed: it throws a TypeError for every input.
Dropping the json_encode() call (keeping $value as the array it already is) is enough to make the branch work, since ColumnSettings::createViewSettingsFromInputArray() accepts exactly that shape. A ViewColumnInformation object list may still need normalising to plain arrays depending on what that method expects.
Introduced in cff2c94a ("refactor(Views): turn some details into objects with early validation", 2025-12-05), so every release from v2.0.0 onwards is affected, including current main.
Tables app version
main (reproduced at 4150d63b), also present in every tag from v2.0.0 onwards
Server operating system / environment
Nextcloud 36.0.0 dev, PHP 8.5, MySQL — nextcloud-docker-dev
Additional info
Found while seeding test data through the API; the frontend sends columnSettings and so never hits this path, which is presumably why it has gone unnoticed.
- Dominant language
- JavaScript
- Stars
- 220
- Forks
- 55
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 79
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud/tables
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Editing a selection column via UI fails with 500 "It is forbidden to set the Uuid from external"Open0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nextcloud/tables#2856 · 5 comments · 4 reactions ·
Maintainers usually reply within 1 day
-
1. to develop bug papercut
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
0. Needs triage enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
All issues in nextcloud/tables
Similar issues
-
bug confirmed js v6
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
BUG
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
linuxmint/cinnamon-spices-applets#9223 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
fastify/fastify-swagger-ui#299 ·