diff options
Diffstat (limited to 'lib/rhbzpage.js')
-rw-r--r-- | lib/rhbzpage.js | 14 |
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); |