Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-3803

Archived artifacts are served with improper mime-types

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:
      Platform: All, OS: All
    • Similar Issues:

      Description

      We use the "Archive build artifacts" to save a number of logs pertaining to the build, these files are
      all text files with a ".log" suffix.

      Regardless of this however, Hudson still serves these files with the 'application/octet-stream' mime-
      type, causing stupid browsers like Firefox to try to download the file instead of render the text.

        Attachments

          Issue Links

            Activity

            rtyler R. Tyler Croy created issue -
            Hide
            jglick Jesse Glick added a comment -

            You can click the "view" link to see it as text.

            Show
            jglick Jesse Glick added a comment - You can click the "view" link to see it as text.
            Hide
            rtyler R. Tyler Croy added a comment -

            On the build page, there aren't any "view" links (unless I'm really that daft)

            The list of build artifacts contain direct links to the artifacts, as well as the little "fingerprint" icon.

            The "view" ilnk in the workspace viewer doesn't really help for looking at build artifacts for older
            builds, only the most recent one.

            Show
            rtyler R. Tyler Croy added a comment - On the build page, there aren't any "view" links (unless I'm really that daft) The list of build artifacts contain direct links to the artifacts, as well as the little "fingerprint" icon. The "view" ilnk in the workspace viewer doesn't really help for looking at build artifacts for older builds, only the most recent one.
            Hide
            remke remke added a comment -

            My case is a bit different, but I suspect it has the same code behind it.
            I want to display a xml file from my workspace which has a link to xslt in it.
            The 'view' link displays the text, but without the xslt applied (I can
            understand that). The link to the file itself opens an 'Open with...' dialog,
            because the Content-type is application/octet-stream.
            Can the content-type be automatically detected from the file extension?

            Show
            remke remke added a comment - My case is a bit different, but I suspect it has the same code behind it. I want to display a xml file from my workspace which has a link to xslt in it. The 'view' link displays the text, but without the xslt applied (I can understand that). The link to the file itself opens an 'Open with...' dialog, because the Content-type is application/octet-stream. Can the content-type be automatically detected from the file extension?
            Hide
            kohsuke Kohsuke Kawaguchi added a comment -

            The MIME type mapping comes from the underlying servlet container. Which one do
            you use? Winstone?

            Show
            kohsuke Kohsuke Kawaguchi added a comment - The MIME type mapping comes from the underlying servlet container. Which one do you use? Winstone?
            kohsuke Kohsuke Kawaguchi made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            Hide
            rtyler R. Tyler Croy added a comment -

            I experience this issue when using the default Hudson container, I'm assuming
            that's Winstone

            Show
            rtyler R. Tyler Croy added a comment - I experience this issue when using the default Hudson container, I'm assuming that's Winstone
            Hide
            remke remke added a comment -

            Answering koshuke's question: Yes, I am using the Winstone servlet engine.
            I found (in Winstone's issue list) your request for more default mime types in
            the Winstone resources
            (http://sourceforge.net/tracker/index.php?func=detail&aid=1746201&group_id=98922&atid=622500).

            The mime types in the Winstone properties are:
            WebAppConfig.DefaultMimeTypes=jpg=image/jpeg:jpeg=image/jpeg:gif=image/gif:css=text/css:js=text/javascript:pdf=application/pdf:txt=text/plain:html=text/html:png=image/png:zip=application/zip:jar=application/java-archive

            I added some extra extension/mime-type combinations to the Hudson web.xml, as
            Rick Knowles (Winstone author) suggested.
            That works, but of course my changes will be gone in the next Hudson update.

            Could you add some entries to the Hudson web.xml?

            Some extensions I am missing are:
            xml: text/xml
            xslt: application/xslt+xml or text/xml
            ear: ???? (don't know if a mime-type exists)
            war: ???? (don't know if a mime-type exists)

            Even better would be a way to add your own mappings external to Hudson, but that
            would mean an enhancement to the servlet container (Winstone in my case) not
            Hudson itself.
            Well, maybe I should switch to a servlet container that supports this by
            default, we deploy our own application on Oracle Application Server (Weblogic in
            the future), so I could use that. I like the simplicity of the embedded Winstone
            container though.

            Show
            remke remke added a comment - Answering koshuke's question: Yes, I am using the Winstone servlet engine. I found (in Winstone's issue list) your request for more default mime types in the Winstone resources ( http://sourceforge.net/tracker/index.php?func=detail&aid=1746201&group_id=98922&atid=622500 ). The mime types in the Winstone properties are: WebAppConfig.DefaultMimeTypes=jpg=image/jpeg:jpeg=image/jpeg:gif=image/gif:css=text/css:js=text/javascript:pdf=application/pdf:txt=text/plain:html=text/html:png=image/png:zip=application/zip:jar=application/java-archive I added some extra extension/mime-type combinations to the Hudson web.xml, as Rick Knowles (Winstone author) suggested. That works, but of course my changes will be gone in the next Hudson update. Could you add some entries to the Hudson web.xml? Some extensions I am missing are: xml: text/xml xslt: application/xslt+xml or text/xml ear: ???? (don't know if a mime-type exists) war: ???? (don't know if a mime-type exists) Even better would be a way to add your own mappings external to Hudson, but that would mean an enhancement to the servlet container (Winstone in my case) not Hudson itself. Well, maybe I should switch to a servlet container that supports this by default, we deploy our own application on Oracle Application Server (Weblogic in the future), so I could use that. I like the simplicity of the embedded Winstone container though.
            Hide
            kohsuke Kohsuke Kawaguchi added a comment -

            Any chance you can send us a patch from what you did?

            Show
            kohsuke Kohsuke Kawaguchi added a comment - Any chance you can send us a patch from what you did?
            Hide
            remke remke added a comment -

            Created an attachment (id=781)
            Patch for web.xml, modify to your needs

            Show
            remke remke added a comment - Created an attachment (id=781) Patch for web.xml, modify to your needs
            Hide
            remke remke added a comment -

            I created a unified diff file for the web.xml. It is very simple, modify to your
            needs.

            Show
            remke remke added a comment - I created a unified diff file for the web.xml. It is very simple, modify to your needs.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in hudson
            User: : kohsuke
            Path:
            trunk/hudson/main/war/resources/WEB-INF/web.xml
            trunk/www/changelog.html
            http://fisheye4.cenqua.com/changelog/hudson/?cs=19730
            Log:
            [FIXED JENKINS-3803] In 1.316.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : kohsuke Path: trunk/hudson/main/war/resources/WEB-INF/web.xml trunk/www/changelog.html http://fisheye4.cenqua.com/changelog/hudson/?cs=19730 Log: [FIXED JENKINS-3803] In 1.316.
            scm_issue_link SCM/JIRA link daemon made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Resolved [ 5 ]
            Hide
            jerryshea jerryshea added a comment -

            Could we also add this to the web.xml to allow serving up of SVG (my build
            generates some of these)?
            svg=image/svg+xml

            Show
            jerryshea jerryshea added a comment - Could we also add this to the web.xml to allow serving up of SVG (my build generates some of these)? svg=image/svg+xml
            abayer Andrew Bayer made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: George Shakhnazaryan
            Path:
            war/src/main/webapp/WEB-INF/web.xml
            http://jenkins-ci.org/commit/jenkins/c1d2c945465d30efb63de7abce51d95289170e63
            Log:
            Adding the video/webm mime type for files with extension .webm. The change is similar to JENKINS-3803, just a different extension.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: George Shakhnazaryan Path: war/src/main/webapp/WEB-INF/web.xml http://jenkins-ci.org/commit/jenkins/c1d2c945465d30efb63de7abce51d95289170e63 Log: Adding the video/webm mime type for files with extension .webm. The change is similar to JENKINS-3803 , just a different extension.
            aheritier Arnaud Héritier made changes -
            Link This issue is related to JENKINS-13496 [ JENKINS-13496 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 133876 ] JNJira + In-Review [ 202461 ]

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rtyler R. Tyler Croy
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: