From 7ced539be325398fc7ecace31201bf89e6335f48 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 19 Sep 2010 00:54:10 +0200 Subject: Add checking of HTTP status in rhbzpage.showAttachment --- lib/rhbzpage.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js index 8dff5be..a3660ad 100644 --- a/lib/rhbzpage.js +++ b/lib/rhbzpage.js @@ -343,17 +343,23 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() { } }; +// FIXME opens wrong attachment id +// https://bugzilla.redhat.com/show_bug.cgi?id=571846 +// has attachment id https://bugzilla.redhat.com/attachment.cgi?id=448235 +// but this opens https://bugzilla.redhat.com/show_bug.cgi?id=571846 RHBugzillaPage.prototype.showAttachment = function showAttachment(id) { var that = this; Request({ - url: "https://" + this.hostname + "/attachment.cgi?id=" + id, + url: "https://" + that.hostname + "/attachment.cgi?id=" + id, onComplete: function () { - var infoWin = that.win.open("", "Check att. " + id, - "width=640,height=640,status=no,location=no,"+ - "titlebar=no,scrollbars=yes,resizable=yes"); - var doc = infoWin.document; - doc.body.innerHTML = "
"+
-                this.response.text + "
"; + if (this.response.status == 200) { + var infoWin = that.win.open("", "Check att. " + id, + "width=640,height=640,status=no,location=no,"+ + "titlebar=no,scrollbars=yes,resizable=yes"); + var doc = infoWin.document; + doc.body.innerHTML = "
"+
+                    this.response.text + "
"; + } } }).get(); }; -- cgit