From 0e4aa6727b26447e4f0c1cdb33818daf0a79d459 Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Tue, 2 Apr 2013 14:37:28 -0400 Subject: [PATCH] Convert to string before using string methods on search operators Previously, narrowing to a stream name that only contained digits would throw an exception. (imported from commit dc76877427078d70e3d5625622c665be3302c976) --- zephyr/static/js/narrow.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zephyr/static/js/narrow.js b/zephyr/static/js/narrow.js index ef1e289632..db38777f97 100644 --- a/zephyr/static/js/narrow.js +++ b/zephyr/static/js/narrow.js @@ -72,7 +72,7 @@ function unparse(operators) { // a colon are glued together to form a search term. parts.push(elem[1]); } else { - parts.push(elem[0] + ':' + encodeOperand(elem[1].toLowerCase())); + parts.push(elem[0] + ':' + encodeOperand(elem[1].toString().toLowerCase())); } }); return parts.join(' '); @@ -200,7 +200,7 @@ function build_filter(operators_mixed_case) { var operators = []; // We don't use $.map because it flattens returned arrays. $.each(operators_mixed_case, function (idx, operator) { - operators.push([operator[0], operator[1].toLowerCase()]); + operators.push([operator[0], operator[1].toString().toLowerCase()]); }); // FIXME: This is probably pretty slow. @@ -294,7 +294,7 @@ exports.activate = function (operators, opts) { var collapse_messages = true; $.each(operators, function (idx, operator) { - if (operator[0].toLowerCase() === 'search') { + if (operator[0].toString().toLowerCase() === 'search') { collapse_messages = false; return false; }