diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/ImportConfigModal.tsx b/monkey/monkey_island/cc/ui/src/components/configuration-components/ImportConfigModal.tsx index 2c7014f2b..403094c4d 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/ImportConfigModal.tsx +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ImportConfigModal.tsx @@ -142,9 +142,20 @@ const ConfigImportModal = (props: Props) => { setErrorMessage('File is not in a valid json format'); return } - setConfigEncrypted(importContents['metadata']['encrypted']); - setConfigContents(importContents['configuration']); - setConfigCredentials(importContents['credentials']); + + try { + setConfigEncrypted(importContents['metadata']['encrypted']); + setConfigContents(importContents['configuration']); + setConfigCredentials(importContents['credentials']); + } catch (e) { + if (e instanceof TypeError) { + setErrorMessage('Missing required fields, configuration file is most ' + + 'likely from an old version') + } + else { + throw e; + } + } }; reader.readAsText(event.target.files[0]); }