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>
pull/48912/head
Claudio Cambra 2024-10-27 19:37:25 +07:00 committed by Joas Schilling
parent e6c11e1be0
commit 5969b4bea8
No known key found for this signature in database
GPG Key ID: F72FA5B49FFA96B0
1 changed files with 8 additions and 2 deletions

@ -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;
}