Receiver with Deck federation disabled answers "Internal error"

Open Beginner friendly
#8,790 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
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
api, backend

Research direction

The fix belongs in lib/Federation/DeckFederationProvider.php, in shareReceived(), where FederationDisabledException escapes near line 49. Compare with how CloudFederationProviderFiles::shareReceived() maps a disabled state to a 503 ProviderCouldNotAddShareException. Done means a unit test shows no board is inserted when federation is disabled and the thrown exception carries status 503 and a clear message.

Written by the indexing model from the issue text.

Description

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.

Dominant language
JavaScript
Stars
1.4k
Forks
380
Avg merge
1d 17h
Merged PRs (30d)
72

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/deck

All issues in nextcloud/deck

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.