aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Cambra <developer@claudiocambra.com>2024-10-27 19:37:25 +0800
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-11-01 14:48:33 +0000
commita4e2a7bb7bca8a374dd5d644c0c191dedfca9201 (patch)
tree8a38ff5c5b5c80ad7fbaf9b8f74288ce1019dac8
parent9bb42ef5573338e5ad61897f3773f71f01a46be3 (diff)
downloadnextcloud-server-a4e2a7bb7bca8a374dd5d644c0c191dedfca9201.tar.gz
nextcloud-server-a4e2a7bb7bca8a374dd5d644c0c191dedfca9201.zip
fix(appsmanagement): Fix exception on generating preview url for screenshots
Some installed apps meant for older server versions might unexpectedly offer up screenshot values in a non-string format (e.g. health). Avoid an exception by checking first if the first app screenshot is indeed a string and otherwise we take the value of the parameter Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
-rw-r--r--apps/settings/lib/Controller/AppSettingsController.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php
index e4a36c986fe..554420862a6 100644
--- a/apps/settings/lib/Controller/AppSettingsController.php
+++ b/apps/settings/lib/Controller/AppSettingsController.php
@@ -254,9 +254,15 @@ class AppSettingsController extends Controller {
$apps = $appClass->listAllApps();
foreach ($apps as $app) {
$app['installed'] = true;
- // locally installed apps have a flatted screenshot property
+
if (isset($app['screenshot'][0])) {
- $app['screenshot'] = $this->createProxyPreviewUrl($app['screenshot'][0]);
+ $appScreenshot = $app['screenshot'][0] ?? null;
+ if (is_array($appScreenshot)) {
+ // Screenshot with thumbnail
+ $appScreenshot = $appScreenshot['@value'];
+ }
+
+ $app['screenshot'] = $this->createProxyPreviewUrl($appScreenshot);
}
$this->allApps[$app['id']] = $app;
}