aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-19 00:24:11 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-19 00:24:11 +0200
commit76e764fb8e4f9d52dc92e97c6408c169142b104f (patch)
tree0ebff09ffed4414fcc3f58ed8744bf692aafde28 /lib
parentcb3869dce7f2cb179240ac6e0653cbfd94e4d0e8 (diff)
downloadbugzilla-triage-76e764fb8e4f9d52dc92e97c6408c169142b104f.tar.gz
There is url.URL object!
Diffstat (limited to 'lib')
-rw-r--r--lib/rhbzpage.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index d41d988..5e27b4b 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -10,6 +10,7 @@ var xhr = require("xhr");
var clip = require("clipboard");
var Color = require("color").Color;
var BZPage = require("bzpage").BZPage;
+var url = require("url");
// var TriagedDistro = 13;
// var NumberOfFrames = 7;
// var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
@@ -666,6 +667,7 @@ RHBugzillaPage.prototype.parseAttachmentLine = function(inElem) {
}
// getting name of the attachment
+ // FIXME probably could use url.URL object
var attName = inElem.getElementsByTagName("b")[0].textContent.trim();
var aHrefsArr = inElem.getElementsByTagName("a");
@@ -845,15 +847,19 @@ RHBugzillaPage.prototype.addClosingUpstream = function() {
var externalBugID = 0;
var wholeURL = "";
+ // FIXME Hopefully unfinished and even less tested
// Fix missing ID on the external_id SELECT
this.doc.getElementsByName("external_id")[0].setAttribute("id",
"external_id");
if (inputBox.value.match(/^http.*/)) {
- var helpAElem = this.doc.createElement("a");
wholeURL = inputBox.value;
- helpAElem.setAttribute("href", wholeURL);
- var paramsArr = helpAElem.search.replace(/^\?/, '').split('&');
+ var helpURL = new url.URL(wholeURL);
+ var paramsArr = helpURL.path.replace(/^\?/, '').split('&');
+ console.log("wholeURL = " + wholeURL);
+ console.log("helpURL = " + helpURL);
+ console.log("helpURL.path = " + helpURL.path);
+ console.log("paramsArr = " + paramsArr.toSource());
// get convert URL parameters to an Object
var params = {}, s = [];
paramsArr.forEach(function(par, idx, arr) {
@@ -865,7 +871,7 @@ RHBugzillaPage.prototype.addClosingUpstream = function() {
inputBox.value = externalBugID;
}
// get host and bugzillaName
- var bugzillaName = this.getBugzillaName(helpAElem.hostname);
+ var bugzillaName = this.getBugzillaName(helpURL.hostname);
this.selectOption("external_id", bugzillaName);
} else if (!isNaN(inputBox.value)) {
externalBugID = parseInt(inputBox.value, 10);