Menu

#307 import dir gets mimetype mixed up

5.0.7
wont-fix
nobody
None
bug
2017-01-03
2017-01-02
No

When importing a dir from a drop folder, files with "docx" or "pptpx" are detected as being "application/zip" (and thus not correctly indexed or shown when "viewing online"). Downloading the file, removing and recreating it results in the correct mimetype (application/vnd.openxmlformats-officedocument.wordprocessingml.document for docx for example)

Discussion

  • Franky Van Liedekerke

    It seems the reason is that the regular php function finfo_open(FILEINFO_MIME_TYPE) returns "application/zip" for MS Office 2007 docs. This is also documented on the php website itself:
    http://php.net/manual/en/function.finfo-file.php
    I haven't figured out how seeddms arrives at the (correct) mimetype "application/vnd.openxmlformats-officedocument.wordprocessingml.document" when creating the doc normally (maybe it looks at the extension "docx"?).
    The complete list of mimetypes can be found at http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types , so maybe a class should be used for mimetype detection?

     
  • Uwe Steinmann

    Uwe Steinmann - 2017-01-03
    • status: open --> wont-fix
     
  • Uwe Steinmann

    Uwe Steinmann - 2017-01-03

    seeddms uses finfo which itself uses the same algorithmn like the file command. I suspected your file info database isn't up to date.

     
  • Franky Van Liedekerke

    Well, it seems that is not the case: the command "file" gives the same application/zip mimetype on both redhat 6 and 7, but the php function calls finfo on EL7 returns the expected mimetype (it has probably a magic file compiled in the fileinfo.so extension). So apparently the minimum requirement for this to work is php 5.4.+

     

Log in to post a comment.

MongoDB Logo MongoDB