Uploaded image for project: 'Hue'
  1. Hue
  2. HUE-5717

Some operating system incorrectly detect javascript mime-type

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.11.0
    • Fix Version/s: None
    • Component/s: core.backend
    • Labels:
      None

      Description

      Turns out django cherrypy server on SLES uses python "mimetypes" module to detect file type. Eventually the mimetype detection on SLES fails to detect javascript as "appication/javascript"
      [root@ranade-510-1 js]# lsb_release -a
      Description: CentOS release 6.6 (Final)
      [root@ranade-510-1 js]# python -c 'import mimetypes; print mimetypes.guess_type("./knockout.min.fa8662c7a841.js")'
      ('text/javascript', None)
      *[root@ranade-510-1 js]# cat /etc/mime.types | grep "js$"
      text/javascript js*

      ranade-sles11sp4-511-1 # lsb_release -a
      Description: SUSE Linux Enterprise Server 11 (x86_64)
      ranade-sles11sp4-511-1 # python -c 'import mimetypes; print mimetypes.guess_type("./knockout.min.fa8662c7a841.js")'
      ('text/x-js', None)
      *ranade-sles11sp4-511-1 # cat /etc/mime.types | grep "js$"
      application/javascript js
      text/x-js js*

      The wrong mimetype could not accepted by local browser(when secure_content_type_nosniff=true) which throws 'MIME type ('text/x-js') is not executable error.
      But if we use "Load Balancer" port then load balancer configuration force mime-type "application/javascript" for "js" files.
      I have implemented fix in django code where if user uses "django" port then django code will force mime-type "application/javscript" for ".js" files.

        Attachments

          Activity

            People

            • Assignee:
              ranade Prakash
              Reporter:
              ranade Prakash
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: