From 8af93c430430e318d98e62743392e889f93a6876 Mon Sep 17 00:00:00 2001 From: Shreya Date: Thu, 1 Jul 2021 13:22:09 +0530 Subject: [PATCH] cc: Add ransomware directory path validation error messages --- .../configuration-components/ValidationErrorMessages.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/ValidationErrorMessages.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/ValidationErrorMessages.js index a5782948a..803e4e7e7 100644 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/ValidationErrorMessages.js +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/ValidationErrorMessages.js @@ -1,4 +1,6 @@ -import {IP, IP_RANGE} from './ValidationFormats'; +import {IP, IP_RANGE, VALID_DIR_LINUX, VALID_DIR_WINDOWS} from './ValidationFormats'; + +let invalidDirMessage = 'Invalid directory. Path should be absolute or begin with an environment variable.'; export default function transformErrors(errors) { return errors.map(error => { @@ -8,6 +10,10 @@ export default function transformErrors(errors) { error.message = 'Invalid IP range, refer to description for valid examples.' } else if (error.name === 'format' && error.params.format === IP) { error.message = 'Invalid IP.' + } else if (error.name === 'format' && error.params.format === VALID_DIR_LINUX) { + error.message = invalidDirMessage + } else if (error.name === 'format' && error.params.format === VALID_DIR_WINDOWS) { + error.message = invalidDirMessage } return error; });