From 674ee02dda38b1c54969d4320127d0e7c8ca25d4 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 25 Jul 2022 10:47:49 +0200 Subject: [PATCH] UI: Reformat empty payloads --- .../components/configuration-components/ReformatHook.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/ReformatHook.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/ReformatHook.js index b5f538347..a26987b37 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/ReformatHook.js +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ReformatHook.js @@ -13,7 +13,12 @@ export function reformatConfig(config, reverse = false) { } formattedConfig['keep_tunnel_open_time'] = formattedConfig['advanced']['keep_tunnel_open_time']; } else { - formattedConfig['payloads'] = formattedConfig['payloads'][0]['options']; + if(formattedConfig['payloads'].length !== 0) + { + formattedConfig['payloads'] = formattedConfig['payloads'][0]['options']; + } else { + formattedConfig['payloads'] = {'encryption': {}, 'other_behaviors': {}} + } formattedConfig['advanced'] = {}; formattedConfig['advanced']['keep_tunnel_open_time'] = formattedConfig['keep_tunnel_open_time']; }