Deprecated `columns` payload on PUT /api/1/views/{viewId} always returns 500
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
lib/Model/ViewUpdateInput.php の 90〜113 行目付近から始めてください。ここでは非推奨の columns 分岐が json_encode() を呼び出し、その結果の文字列を lib/Model/ColumnSettings.php の ColumnSettings::createViewSettingsFromInputArray() に渡していますが、この関数は配列を期待しています。issue にある curl PUT で再現し、そのうえで ViewColumnInformation のリストを単純な配列に正規化する必要があるか確認してください。このリクエストが 500 を返さずビューの列を更新し、新しい形式も引き続き動作すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- JavaScript
- スター
- 220
- フォーク
- 57
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 76
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nextcloud/tables のほかの issue
-
0. Needs triage bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
0. Needs triage bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Editing a selection column via UI fails with 500 "It is forbidden to set the Uuid from external"オープン0. Needs triage bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
nextcloud/tables#2856 · コメント 5 件 · リアクション 4 件 ·
メンテナーはふだん 1 日以内に返信
-
1. to develop bug papercut
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
0. Needs triage enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
nextcloud/tables の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
obsidianmd/obsidian-help#1169 ·
メンテナーはふだん 2 日以内に返信
-
[docs] RELEASE.md: wrong branch name, no check that the prepare PR merged with the right subject, manual publish step対応中かも @albertteoh が今日担当しました。 オープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
jaegertracing/jaeger-ui#4739 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
keepassxreboot/keepassxc-browser#3159 · コメント 1 件 ·
-
Add: ESP 2 RSオープンapproved check:passed feeds:add
難易度 1/5 1時間未満 初心者へのやさしさ 67/100