Skip to content

Commit

Permalink
Merge pull request #49740 from nextcloud/bugfix/noid/compatibility-wi…
Browse files Browse the repository at this point in the history
…th-30

fix(federation): Restore compatibility with Nextcloud 30 servers
  • Loading branch information
nickvergessen authored Dec 9, 2024
2 parents 0c4794b + 75c16a7 commit 168f383
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/private/OCM/Model/OCMProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ public function getSignatory(): ?Signatory {
*/
public function import(array $data): static {
$this->setEnabled(is_bool($data['enabled'] ?? '') ? $data['enabled'] : false)
->setApiVersion((string)($data['version'] ?? ''))
// Fall back to old apiVersion for Nextcloud 30 compatibility
->setApiVersion((string)($data['version'] ?? $data['apiVersion'] ?? ''))
->setEndPoint($data['endPoint'] ?? '');

$resources = [];
Expand All @@ -182,12 +183,14 @@ public function import(array $data): static {
}
$this->setResourceTypes($resources);

// import details about the remote request signing public key, if available
$signatory = new Signatory();
$signatory->setKeyId($data['publicKey']['keyId'] ?? '');
$signatory->setPublicKey($data['publicKey']['publicKeyPem'] ?? '');
if ($signatory->getKeyId() !== '' && $signatory->getPublicKey() !== '') {
$this->setSignatory($signatory);
if (isset($data['publicKey'])) {
// import details about the remote request signing public key, if available
$signatory = new Signatory();
$signatory->setKeyId($data['publicKey']['keyId'] ?? '');
$signatory->setPublicKey($data['publicKey']['publicKeyPem'] ?? '');
if ($signatory->getKeyId() !== '' && $signatory->getPublicKey() !== '') {
$this->setSignatory($signatory);
}
}

if (!$this->looksValid()) {
Expand Down

0 comments on commit 168f383

Please sign in to comment.