Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-29097

Detect broader set of MIME types for uploaded files

    XMLWordPrintable

Details

    Description

      Currently to detect the MIME type eZ Platform uses league/flysystem library, which in turn uses finfo::file from PHP (http://php.net/manual/en/function.finfo-file.php). This PHP function uses libmagic under the hood (https://github.com/php/php-src/blob/master/ext/fileinfo/fileinfo.c#L471). This means that the result MIME type depends on libmagic configuration.
      There are some files, for which the MIME type is not correctly determined using this method. For example, ".potx" files should have "application/vnd.openxmlformats-officedocument.presentationml.template" as their MIME type, but instead the following is returned: "application/vnd.openxmlformats-officedocument.presentationml.presentation".
      To fix this, a new test for libmagic would have to be created to determine if the file is a "PowerPoint Open XML Presentation Template" (or something different), but it is problematic.
      Alternatively, we can consider using some library with a broader set of supported MIME types. For example, something similar to the following: https://github.com/ralouphie/mimey. It is extension based, and we should not trust extensions in terms of security, but for other usages, it might be helpful for some edge-cases.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jacek.foremski-obsolete@ez.no Jacek Foremski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: