From f1e2970040b55ac485d5eccd2b76235a9156bcc3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 9 Dec 2024 14:43:53 +0100 Subject: fix(federation): Restore compatibility with Nextcloud 30 servers Signed-off-by: Joas Schilling --- lib/private/OCM/Model/OCMProvider.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 61005d3089d..7ae413fa136 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -182,12 +182,14 @@ class OCMProvider implements IOCMProvider { } $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()) { -- cgit v1.2.3 From 75c16a722b58d2abc772f6e6b18292020fc183e6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 9 Dec 2024 16:15:50 +0100 Subject: fix(federation): Fall back to old version flag Signed-off-by: Joas Schilling --- lib/private/OCM/Model/OCMProvider.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 7ae413fa136..99a3770faef 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -172,7 +172,8 @@ class OCMProvider implements IOCMProvider { */ 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 = []; -- cgit v1.2.3