diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-21 09:15:55 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-03-23 18:34:20 +0000 |
commit | 68ddad80e1b10f87610911dfeea16fd39484971b (patch) | |
tree | 9cb8ce43a9e59b45eb092956e45fc8ad08deeffa | |
parent | c544e04856bd5814350b7bbb9c57e058f12ebade (diff) | |
download | nextcloud-server-backport/51622/stable31.tar.gz nextcloud-server-backport/51622/stable31.zip |
fix(ocm): `publicKey` can be disabled so capabilities do not matchbackport/51622/stable31
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 * }, |