Unverified Commit 91bea3dd authored by Conor Broderick's avatar Conor Broderick Committed by GitHub

Merge pull request #932 from paystee/fix-label-matching

Fix label matching in routing tree editor
parents a3bfe8c8 2f78f749
...@@ -115,7 +115,10 @@ function matchLabels(matchers, labelSet) { ...@@ -115,7 +115,10 @@ function matchLabels(matchers, labelSet) {
// Compare single matcher to labelSet // Compare single matcher to labelSet
function matchLabel(matcher, labelSet) { function matchLabel(matcher, labelSet) {
var v = labelSet[matcher.name]; var v = "";
if (matcher.name in labelSet) {
v = labelSet[matcher.name];
}
if (matcher.isRegex) { if (matcher.isRegex) {
return matcher.value.test(v) return matcher.value.test(v)
...@@ -156,7 +159,7 @@ function massage(root) { ...@@ -156,7 +159,7 @@ function massage(root) {
for (var key in root.match_re) { for (var key in root.match_re) {
var o = {}; var o = {};
o.isRegex = true; o.isRegex = true;
o.value = new RegExp(root.match_re[key]); o.value = new RegExp("^(?:" + root.match_re[key] + ")$");
o.name = key; o.name = key;
matchers.push(o); matchers.push(o);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment