MXS-2893: Fix parameter validation
The code assumed all parameters were string values. Encasing the code in a try-catch block solves it.
This commit is contained in:
@ -22,8 +22,12 @@ function to_obj(obj, value) {
|
|||||||
function validateParams(argv, params) {
|
function validateParams(argv, params) {
|
||||||
var rval = null;
|
var rval = null;
|
||||||
params.forEach((value) => {
|
params.forEach((value) => {
|
||||||
var kv = value.split('=')
|
try {
|
||||||
if (!kv || kv.length != 2) {
|
var kv = value.split('=')
|
||||||
|
if (!kv || kv.length != 2) {
|
||||||
|
rval = 'Not a key-value parameter: ' + value
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
rval = 'Not a key-value parameter: ' + value
|
rval = 'Not a key-value parameter: ' + value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user