Updated version of “Bug attachment source”

The Bug attachment source user script adds "source" links for each attachment, making it easier to see the source of attachments that demonstrate crash bugs. For zip attachments, it adds a "contents" link instead.

A recent Bugzilla upgrade changed the attachment table in a way that broke the script. Dan Veditz updated the script to work with the new version of Bugzilla (he got back from vacation before I did).

To use it in Firefox, you need to install Greasemonkey first. (Greasemonkey works fine with Firefox trunk, by the way.)

7 Responses to “Updated version of “Bug attachment source””

  1. Anders Says:

    Ehm, why not add the features directly to Bugzilla?

  2. Jesse Ruderman Says:

    It might make sense to add the “source” feature to Bugzilla, or at least to Bugzilla installations used for tracking bugs in web browsers (mozilla’s, webkit’s, and opera’s). But there are browser compatibility issues: Firefox users will prefer “view-source:” for syntax highlighting, while most IE users will prefer a server-side text/plain so they can view the source in a browser window. Firefox users can take advantage of “jar:” but users of other browsers cannot.

  3. Jesse Ruderman Says:

    while most IE users will prefer a server-side text/plain so they can view the source in a browser window

    Except that (as justdave pointed out) IE would do its bogus content sniffing and decide to parse the attachment as HTML anyway. So maybe “view-source:” is the right thing to do for IE too.

  4. Dave Miller Says:

    Of course, you could always HTML-escape the entire thing and put it in an HTML content type in a <pre> block.

  5. pile0nades Says:

    This script doesn’t work when my Bugzilla Enhancements script is installed, because it detects the comment links it adds and fails on the attachment.cgi check. The fix is to change:

    attachLink = row.cells[0].getElementsByTagName(“a”)[0];
    if (!attachLink)
    continue;

    attachHref = attachLink.href;
    if (!attachHref.match(/attachment\.cgi\?id\=\d+/))
    continue;

    to:

    attachLink = row.cells[0].getElementsByTagName(“a”);
    for(var j = 0; j

  6. pile0nades Says:

    Oops, comment got cut off. The fix is:

    attachLink = row.cells[0].getElementsByTagName(“a”);
    for(var j = 0; j &lt attachLink.length; j++) {
    attachHref = attachLink[i].href;
    if (!attachHref.match(/attachment\.cgi\?id\=\d+/))
    continue;
    }

  7. pile0nades Says:

    &lt = <