Skip to content

Commit 1ae5cb4

Browse files
committed
fix(plugins-controller) fix issue with empty manifest and settings yaml files
1 parent 98e4aed commit 1ae5cb4

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

app/Controllers/PluginsController.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@
1515

1616
class PluginsController
1717
{
18-
19-
/**
20-
* __construct
21-
*/
22-
public function __construct()
23-
{
24-
25-
}
26-
2718
/**
2819
* Index page
2920
*
@@ -72,8 +63,9 @@ public function pluginStatusProcess(Request $request, Response $response) : Resp
7263
// Get data from the request
7364
$post_data = $request->getParsedBody();
7465

75-
$custom_plugin_settings_file = PATH['project'] . '/config/' . '/plugins/' . $post_data['plugin-key'] . '/settings.yaml';
76-
$custom_plugin_settings_file_data = flextype('serializers')->yaml()->decode(Filesystem::read($custom_plugin_settings_file));
66+
$custom_plugin_settings_file = PATH['project'] . '/config/plugins/' . $post_data['plugin-key'] . '/settings.yaml';
67+
$custom_plugin_settings_file_content = Filesystem::read($custom_plugin_settings_file);
68+
$custom_plugin_settings_file_data = empty($custom_plugin_settings_file_content) ? [] : flextype('serializers')->yaml()->decode($custom_plugin_settings_file_content);
7769

7870
$status = ($post_data['plugin-set-status'] == 'true') ? true : false;
7971

0 commit comments

Comments
 (0)