aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-09-19 00:34:48 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-09-19 00:34:48 +0200
commitc2a09508ae88149e615bd8f393858dd927f491cf (patch)
treea7be1ef25ebb4266f63bd3fc4e07ec02a166b0b2
parent88112016166ac10e7ed2848c9562bed211918748 (diff)
downloadbugzilla-triage-c2a09508ae88149e615bd8f393858dd927f491cf.tar.gz
Fix .split() method
-rw-r--r--lib/bzpage.js6
-rw-r--r--lib/rhbzpage.js3
-rw-r--r--lib/util.js8
3 files changed, 7 insertions, 10 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index 96ad655..2278209 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -177,10 +177,10 @@ BZPage.prototype.getInstalledPackages = function getInstalledPackages(cfg) {
if ("enabledPackages" in cfg.gJSONData.configData) {
var epObject = cfg.gJSONData.configData.enabledPackages;
if (this.hostname in epObject) {
- enabledPackages = enabledPackages.concat(epObject[this.hostname].split(/[, ]/));
+ enabledPackages = enabledPackages.concat(epObject[this.hostname].split(/[,\s]+/));
}
if ("any" in epObject) {
- enabledPackages = enabledPackages.concat(epObject.any.split(/[, ]/));
+ enabledPackages = enabledPackages.concat(epObject.any.split(/[,\s]+/));
}
}
@@ -739,7 +739,7 @@ BZPage.prototype.idContainsWord = function idContainsWord (id, str) {
// For those who don't have particular element at all or if it is empty
return false;
}
- return (util.isInList(str, kwd.trim().split(/,\s*/)));
+ return (util.isInList(str, kwd.trim().split(/[,\s]+/)));
};
/**
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index 11471f5..8dff5be 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -243,8 +243,6 @@ RHBugzillaPage.prototype.addAttachment = function addAttachment(data, callback)
msg.addParameter({
description: titleParsedAttachment,
filename: "parsed-backtrace.txt",
- // Isn't this weird ... base64 and text/plain??? FIXME
- // and XML-RPC and text/plain?
contenttype: "text/plain",
data: this.win.btoa(data),
nomail: true
@@ -334,7 +332,6 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() {
}, this);
}
// Add "show BT" links
- console.log("status_whiteboard = " + this.doc.getElementById('status_whiteboard').value);
if (this.idContainsWord("status_whiteboard", 'btparsed')) {
var ourParsedAtts = this.attachments.filter(function (att) {
return (new RegExp(titleParsedAttachment).test(att[0]));
diff --git a/lib/util.js b/lib/util.js
index 88c3457..b258c5f 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -129,7 +129,7 @@ var valToArray = exports.valToArray = function valToArray(val) {
* @return String with merged lists
*/
exports.addCSVValue = function addCSVValue(str, value) {
- var parts = (str.trim().length > 0 ? str.split(/,\s*/) : []);
+ var parts = (str.trim().length > 0 ? str.split(/[,\s]+/) : []);
if (!value) {
return str;
}
@@ -152,8 +152,8 @@ exports.addCSVValue = function addCSVValue(str, value) {
*/
exports.removeCSVValue = function removeCSVValue(str, value) {
str = str.trim();
- var parts = str ? str.split(/,\s*/) : [];
- var valueArr = value instanceof Array ? value : value.split(/,\s*/);
+ var parts = str ? str.split(/[,\s]+/) : [];
+ var valueArr = value instanceof Array ? value : value.split(/[,\s]+/);
parts = parts.filter(function (e, i, a) {
return (!isInList(e, valueArr));
});
@@ -196,7 +196,7 @@ var filterByRegexp = exports.filterByRegexp =
*/
exports.killNodes = function killNodes(doc, target, remove) {
target = target.trim();
- var targetArr = target instanceof Array ? target : target.split(/,\s*/);
+ var targetArr = target instanceof Array ? target : target.split(/[,\s]+/);
targetArr.forEach(function(x) {
if (remove) {
var targetNode = doc.getElementById(x);