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

Archived artifacts are served with improper mime-types

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • core
    • None
    • Platform: All, OS: All

    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

            jglick Jesse Glick added a comment -

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

            jglick Jesse Glick added a comment - You can click the "view" link to see it as text.
            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.

            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.
            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?

            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?

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

            kohsuke Kohsuke Kawaguchi added a comment - The MIME type mapping comes from the underlying servlet container. Which one do you use? Winstone?
            rtyler R. Tyler Croy added a comment -

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

            rtyler R. Tyler Croy added a comment - I experience this issue when using the default Hudson container, I'm assuming that's Winstone
            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.

            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.

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

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

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

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

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

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

            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 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.
            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

            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

            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.

            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.

            People

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

              Dates

                Created:
                Updated:
                Resolved: