aboutsummaryrefslogtreecommitdiffstats
path: root/lib/logger.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-23 15:11:44 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-23 15:11:44 +0200
commitd3a21445ad2f70565d10f632aa9d522e190f9e00 (patch)
treebb2d112daddb98d8394e81b6f4712754fbed58ed /lib/logger.js
parent5f4a854cf9497d07745ebd9d4c65a3b954c494ec (diff)
downloadbugzilla-triage-d3a21445ad2f70565d10f632aa9d522e190f9e00.tar.gz
Fix timesheet generation with bad URLs and get activated on the Freedesktop bugzilla as well
Diffstat (limited to 'lib/logger.js')
-rw-r--r--lib/logger.js48
1 files changed, 26 insertions, 22 deletions
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>";
+ });
+ };
/**
*