cc: Add ransomware directory path validation error messages
This commit is contained in:
parent
73c61ebcf0
commit
8af93c4304
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue