Pierre van Rooden <[EMAIL PROTECTED]> wrote:
> > Now, when I upload a Word attachment I get a "Failed to determine 
> > filetype" (PDF results in mime-type PDF (which is also incorrect and 
> > should be "application/pdf" if I understand Pierre correctly)). 
> 
> Word is hard to determine. I don't think MMBase currently supports a
> good way to detect Word docs.  The PDF-bug is a known bug. We located
> it, it should be fixed in 1.7 or 1.6.4 (maybe Michiel can confirm
> this?).

The PDF-bug was not the problem of Sandra, because she asserted that the
mime-type was correct. I just spotted it accidentely while exploring the
matterr.  Her problem was the behaviour of browsers, which do offer to
'download' when the content-disposition is 'attachment' which it is
generally for mmbase attachents. For 'pdfs' it could also be 'inline'
because most browsers know how to deal with them. The work around I
suggested it to force using image-servlet for pdf's. I think we should come
up with a better way for this:

1. Perhaps content-disposition of attachementservlet must also be 'inline'.
2. Perhaps it must depend on the mime-type (certian mimetyps can be 'inline'
   others 'attachment'.
3. Perhaps it must be configurable with an attribute on <mm:attachment e.g.

> 
> The problem is in the magic.xml file (a config file in the root
> configuraton directory), which contains directive son how to determine a
> file's type.
> 
> This file is not complete, and sometimes contains errors (as with the
> pdf). However you can edit it so it can recognize the documents you want
> to detect.

The idea for an alternative implementation based on system calls to the
'file' command has been around for long. I think it would be fairly easy to
implement (especially using the new 'externalprocess' stuff from
org.mmbase.util), and I think it is a good idea to try if this would provide
a more robust magic-detection.

 Michiel


-- 
Michiel Meeuwissen 
Mediapark C101 Hilversum  
+31 (0)35 6772979
nl_NL, eo, en_US
mihxil'
[]()

Reply via email to