Receiver with Deck federation disabled answers "Internal error"

Aberta Para iniciantes
#8,790 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
82/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
php
Domínio
api, backend

Direção de pesquisa

A correção deve ficar em lib/Federation/DeckFederationProvider.php, em shareReceived(), onde FederationDisabledException escapa perto da linha 49. Compare com a forma como CloudFederationProviderFiles::shareReceived() converte um estado desabilitado em uma ProviderCouldNotAddShareException com status 503. Está pronto quando um teste unitário mostra que nenhum board é inserido quando a federação está desabilitada e que a exceção lançada traz o status 503 e uma mensagem clara.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
JavaScript
Estrelas
1.4k
Forks
380
Merge médio
1d 17h
PRs com merge (30d)
72

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de nextcloud/deck

Todas as issues de nextcloud/deck

Issues semelhantes

Mais issues de JavaScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.