Fix potential bug in key array params expanding
This commit is contained in:
13
dist/test/datasource-zabbix/utils.js
vendored
13
dist/test/datasource-zabbix/utils.js
vendored
@@ -49,15 +49,22 @@ function expandItemName(name, key) {
|
||||
function splitKeyParams(paramStr) {
|
||||
var params = [];
|
||||
var quoted = false;
|
||||
var in_array = false;
|
||||
var split_symbol = ',';
|
||||
var param = '';
|
||||
|
||||
_lodash2.default.forEach(paramStr, function (symbol) {
|
||||
if (symbol === '"' && !quoted) {
|
||||
quoted = true;
|
||||
if (symbol === '"' && in_array) {
|
||||
param += symbol;
|
||||
} else if (symbol === '"' && quoted) {
|
||||
quoted = false;
|
||||
} else if (symbol === split_symbol && !quoted) {
|
||||
} else if (symbol === '"' && !quoted) {
|
||||
quoted = true;
|
||||
} else if (symbol === '[' && !quoted) {
|
||||
in_array = true;
|
||||
} else if (symbol === ']' && !quoted) {
|
||||
in_array = false;
|
||||
} else if (symbol === split_symbol && !quoted && !in_array) {
|
||||
params.push(param);
|
||||
param = '';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user