diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-21 09:15:55 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-21 09:15:55 +0100 |
commit | b9f919089417af9821255200f388b18f0f00b2cb (patch) | |
tree | 340f091b6d0dfbf489147e3e468c22ee6b70268e | |
parent | 3d38a4bddeb8d002269b965ac2f4cc2bc06492f5 (diff) | |
download | nextcloud-server-fix/ocm-public-key-is-optional.tar.gz nextcloud-server-fix/ocm-public-key-is-optional.zip |
fix(ocm): `publicKey` can be disabled so capabilities do not matchfix/ocm-public-key-is-optional
When the public key feature is disabled null is returned for
`publicKey`. So in this case we need to adjust the capabilities
and return type of `jsonSerialize()`.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | apps/cloud_federation_api/lib/Capabilities.php | 2 | ||||
-rw-r--r-- | apps/cloud_federation_api/openapi.json | 1 | ||||
-rw-r--r-- | lib/private/OCM/Model/OCMProvider.php | 4 | ||||
-rw-r--r-- | lib/public/OCM/IOCMProvider.php | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php index deca7fe1733..8957fb8b9d8 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -38,7 +38,7 @@ class Capabilities implements ICapability { * apiVersion: '1.0-proposal1', * enabled: bool, * endPoint: string, - * publicKey: array{ + * publicKey?: array{ * keyId: string, * publicKeyPem: string, * }, diff --git a/apps/cloud_federation_api/openapi.json b/apps/cloud_federation_api/openapi.json index 1c69ea2d083..730af73628f 100644 --- a/apps/cloud_federation_api/openapi.json +++ b/apps/cloud_federation_api/openapi.json @@ -46,7 +46,6 @@ "apiVersion", "enabled", "endPoint", - "publicKey", "resourceTypes", "version" ], diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 99a3770faef..f4b0ac584de 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -213,7 +213,7 @@ class OCMProvider implements IOCMProvider { * enabled: bool, * apiVersion: '1.0-proposal1', * endPoint: string, - * publicKey: array{ + * publicKey?: array{ * keyId: string, * publicKeyPem: string * }, @@ -236,7 +236,7 @@ class OCMProvider implements IOCMProvider { 'apiVersion' => '1.0-proposal1', // deprecated, but keep it to stay compatible with old version 'version' => $this->getApiVersion(), // informative but real version 'endPoint' => $this->getEndPoint(), - 'publicKey' => $this->getSignatory()->jsonSerialize(), + 'publicKey' => $this->getSignatory()?->jsonSerialize(), 'resourceTypes' => $resourceTypes ]; } diff --git a/lib/public/OCM/IOCMProvider.php b/lib/public/OCM/IOCMProvider.php index a588d869655..a267abc52d2 100644 --- a/lib/public/OCM/IOCMProvider.php +++ b/lib/public/OCM/IOCMProvider.php @@ -151,7 +151,7 @@ interface IOCMProvider extends JsonSerializable { * enabled: bool, * apiVersion: '1.0-proposal1', * endPoint: string, - * publicKey: array{ + * publicKey?: array{ * keyId: string, * publicKeyPem: string * }, |