Fix potential bug in key array params expanding

This commit is contained in:
Alexander Zobnin
2017-05-17 22:04:26 +03:00
parent 253ed4fb72
commit b0344dc817
7 changed files with 119 additions and 10 deletions

View File

@@ -25,15 +25,22 @@ export function expandItemName(name, key) {
function splitKeyParams(paramStr) {
let params = [];
let quoted = false;
let in_array = false;
let split_symbol = ',';
let param = '';
_.forEach(paramStr, 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 {