Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-879

Wrong mime type calculation on file upload depending on browser and OS

    XMLWordPrintable

    Details

      Description

      How to reproduce

      • Create podcast resource
      • Login using windows and e.g. IE9
      • Upload FLV file as podcast episode
        => height and width of movie can not be set
        => in the item.xml file the mime-type is set to application/octet-stream instead of video/x-flv

      The problem is: browsers send the mime type of the file they upload. Some browsers / OS are more stupid than others and don't know what they transmit. Other issue is that it is not really deterministic what file ending maps to what mime type.

      To fix this, we change the order of the mime-type calculation:

      1) Try to create the mime-type from the file ending using the servletContext.getMimeType() method
      2) If not found, use browser provided mime-type
      3) If still not found use application/octetstream

      As a result it is important to have an up-to-date mime-type specification in tomcats web.xml

        Attachments

          Activity

            People

            Assignee:
            gnaegi Florian Gnägi
            Reporter:
            gnaegi Florian Gnägi
            Tester:
            Kirsten Scherer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 hours
                2h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 30 minutes Time Not Required
                1h 30m