diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 61005d3089d52..99a3770faef65 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -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 = []; @@ -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()) {