diff options
author | Claudio Cambra <developer@claudiocambra.com> | 2024-10-27 19:37:25 +0800 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-10-28 08:29:16 +0100 |
commit | 5969b4bea84f82965edb0298f274b23c678858c8 (patch) | |
tree | b2745889a452fd0ca77400fe36a447c683cc5ff7 | |
parent | e6c11e1be09a13b13df0371b2cff56656c93d4da (diff) | |
download | nextcloud-server-5969b4bea84f82965edb0298f274b23c678858c8.tar.gz nextcloud-server-5969b4bea84f82965edb0298f274b23c678858c8.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.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index 60c796adfb4..a27de4e9673 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -245,9 +245,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; } |