aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--lib/logger.js48
-rw-r--r--lib/main.js1
-rw-r--r--lib/util.js4
4 files changed, 30 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index e95c52d..e2ffc0d 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,3 @@ all: install
install:
rsync -avz jsons/RH_Data-packages.json \
/home/matej/Dokumenty/website/ceplovi.cz/matej/progs/data/
-
-test:
- cfx run -a firefox -P ~/.mozilla/firefox/zj3uh9ia.devel-SDK/ &
diff --git a/lib/logger.js b/lib/logger.js
index 01c626d..ecd7e27 100644
--- a/lib/logger.js
+++ b/lib/logger.js
@@ -84,28 +84,32 @@ Logger.prototype.timeSheetRecordsPrinter = function(body, records) {
var currentDay = "";
// now print the array
tmpArr.forEach(function(rec) {
- var x = rec[1];
- var dayStr = utilMod.getISODate(x.date);
- var host = urlMod.URL(x.url).host;
- var BZName = that.getBugzillaAbbr(x.url);
- var bugNo = utilMod.getBugNo(x.url);
- if (dayStr != currentDay) {
- currentDay = dayStr;
- body.innerHTML += "<hr/><p><strong>" + currentDay
- + "</strong></p>";
- }
- // replace "bug ####" with a hyperlink to the current bugzilla
- var comment = x.comment.replace(commentBugRE,
- "<a href='http://"+host+"/show_bug.cgi?id=$1'>$&</a>");
- body.innerHTML += "<p><em><a href='"
- + x.url
- + "'>Bug "
- + BZName + "/" + bugNo + ": "
- + x.title
- + "</a>"
- + " </em>\n<br/>" + comment + "</p>";
- });
-};
+ var x = rec[1];
+ var dayStr = utilMod.getISODate(x.date);
+ var host = urlMod.URL(x.url).host;
+ var BZName = that.getBugzillaAbbr(x.url);
+ var bugNo = utilMod.getBugNo(x.url);
+ // protection against misbehaving URLs
+ if (!bugNo) {
+ throw new Error("wrong record:\n" + rec.toSource() + "\n");
+ }
+ if (dayStr != currentDay) {
+ currentDay = dayStr;
+ body.innerHTML += "<hr/><p><strong>" + currentDay
+ + "</strong></p>";
+ }
+ // replace "bug ####" with a hyperlink to the current bugzilla
+ var comment = x.comment.replace(commentBugRE,
+ "<a href='http://"+host+"/show_bug.cgi?id=$1'>$&</a>");
+ body.innerHTML += "<p><em><a href='"
+ + x.url
+ + "'>Bug "
+ + BZName + "/" + bugNo + ": "
+ + x.title
+ + "</a>"
+ + " </em>\n<br/>" + comment + "</p>";
+ });
+ };
/**
*
diff --git a/lib/main.js b/lib/main.js
index e0a1fe0..7cd9a9c 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -26,6 +26,7 @@ var config = {};
config.matches = [
"https://bugzilla.redhat.com/show_bug.cgi",
"https://bz-web2-test.devel.redhat.com/show_bug.cgi",
+ "https://bugs.freedesktop.org/show_bug.cgi",
"https://bugzilla.mozilla.org/show_bug.cgi"
];
diff --git a/lib/util.js b/lib/util.js
index b165567..b2a093c 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -36,15 +36,17 @@ exports.heir = function heir(p) {
exports.getBugNo = function getBugNo(url) {
+ console.log("url = " + url);
var re = new RegExp(".*id=([0-9]+).*$");
var bugNo = null;
if (!url) {
throw new Error("Missing URL value!");
}
var reResult = re.exec(url);
- if (reResult[1]) {
+ if (reResult && reResult[1]) {
bugNo = reResult[1];
}
+ console.log("bugNo = " + bugNo);
return bugNo;
};