Add null guard to tag parsing function to prevent parsing values that don't match tag RegEx.

pull/10616/head
Hunter Trujillo 2017-11-21 13:51:02 -07:00
parent efbc7e0853
commit 930f52bb04
1 changed files with 12 additions and 8 deletions

View File

@ -196,17 +196,21 @@ function parseSeries(series) {
function parseTag(s, obj) {
const match = tag.exec(s)
const kv = match[0]
const key = match[1]
const value = match[2]
if (match) {
const kv = match[0]
const key = match[1]
const value = match[2]
if (key) {
if (!obj.tags) {
obj.tags = {}
if (key) {
if (!obj.tags) {
obj.tags = {}
}
obj.tags[key] = value
}
obj.tags[key] = value
return s.slice(match.index + kv.length)
}
return s.slice(match.index + kv.length)
return ''
}
let workStr = series.slice()