Receiver with Deck federation disabled answers "Internal error"

オープン 初心者向け
#8,790 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
api, backend

調査の方向性

修正は lib/Federation/DeckFederationProvider.php の shareReceived() に入れてください。約49行目付近で FederationDisabledException が外に漏れています。CloudFederationProviderFiles::shareReceived() が無効状態を 503 の ProviderCouldNotAddShareException にどう変換しているかを参考にしてください。完了の条件は、フェデレーションが無効な場合にボードが挿入されないことを単体テストで示し、送出される例外がステータス 503 と分かりやすいメッセージを持つことです。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug
When a board share arrives on an instance where Deck federation is disabled, DeckFederationProvider::shareReceived() lets FederationDisabledException escape:
https://github.com/nextcloud/deck/blob/bf65da22e13a366c70c72391beaee00ed2152810/lib/Federation/DeckFederationProvider.php#L49

The OCM request handler does not know this exception. It logs it as an error and answers 400 {"message":"Internal error at https://…"}. The sender cannot tell what went wrong.

To Reproduce

  1. Disable Deck federation on instance B, keep it enabled on instance A.
  2. On instance A, share a board with a user on instance B.
  3. Instance A's log shows 400 Bad Request … {"message":"Internal error at …"}. Instance B logs FederationDisabledException: Federation is disabled as an error.

Expected behavior
The receiver answers with a clear reason.

Suggested fix
Convert the exception into the one the OCM handler understands, with 503, the same way federated file sharing rejects shares when it is disabled (CloudFederationProviderFiles::shareReceived()):

try {
	$this->configService->ensureFederationEnabled();
} catch (FederationDisabledException $e) {
	throw new ProviderCouldNotAddShareException('Deck federation is disabled on this server', '', Http::STATUS_SERVICE_UNAVAILABLE, $e);
}

A unit test can assert that no board is inserted and that the exception carries 503 and the message. I tested this change with a unit test and on the two instances below: the sender now gets 503 with this message, and the receiver no longer logs an error.

Server details

Two instances, both Docker, MariaDB 11.8 / MySQL, PHP 8.5.13:

  • Instance A: Nextcloud 35.0.3, Deck 1.19.2
  • Instance B: Nextcloud 34.0.6, Deck 1.18.7

The code paths are unchanged on main (bf65da22e).


This report was drafted with AI assistance (Claude Code) and reproduced on the two instances above.

主要言語
JavaScript
スター
1.4k
フォーク
380
平均マージ
1日 17時間
マージ済み PR(30日)
72

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nextcloud/deck のほかの issue

nextcloud/deck の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。