Receiver with Deck federation disabled answers "Internal error"

Đang mở Phù hợp với người mới
#8,790 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
api, backend

Hướng nghiên cứu

Phần sửa nằm trong lib/Federation/DeckFederationProvider.php, ở shareReceived(), nơi FederationDisabledException thoát ra gần dòng 49. Hãy so sánh với cách CloudFederationProviderFiles::shareReceived() chuyển trạng thái bị vô hiệu hóa thành ProviderCouldNotAddShareException với mã 503. Việc được coi là hoàn tất khi một unit test cho thấy không có board nào được chèn khi federation bị vô hiệu hóa, và ngoại lệ được ném ra mang mã trạng thái 503 cùng một thông báo rõ ràng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
380
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
72

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nextcloud/deck

Tất cả issue của nextcloud/deck

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.