WebDAV drag and drop mime type for .msg files

I am implementing a variation of this solution.

I have added nuxeo xml extensions for the .msg file extension with a mime type of “application/vnd.ms-outlook” in two places:

 <mimetype normalized="application/vnd.ms-outlook" binary="true"
  iconPath="email.png" onlineEditable="true" oleSupported="true">
  <mimetypes>
    <mimetype>application/vnd.ms-outlook</mimetype>
  </mimetypes>
  <extensions>
    <extension>msg</extension>
  </extensions>
</mimetype>

<mime-mapping>
    <extension>msg</extension>
    <mime-type>application/vnd.ms-outlook</mime-type>
</mime-mapping>

When I drag and drop an email from ms-outlook email client to a Nuxeo webDAV folder the mime type of .msg file extension files is application/octet-stream, this causes the mime-type the check for the application/vnd.ms-outlook mime type to fail and therefore no conversion of the email takes place as outlined in the blog reference above.

Question: How do I change the mime type for a file which is drag and dropped into Nuxeo through the webDAV interface? I need to see application/vnd.ms-outlook for .msg file extensions.

0 votes

1 answers

1778 views

ANSWER



Using the method call (shown below) to the mimeService in Nuxeo as well as adding a mime extensions for .msg allows me to detect the .msg files even though they are originally set to application/octet-stream. I can then change the mimeType in the Blob to application/vnd.ms-outlook.

I looks like the Nuxeo code just sets everything dropped into a webDAV workspace as an application/octet-stream without any checking; was this done for performance??

String detectedMimeType = mimeService.getMimetypeFromFilenameAndBlobWithDefault(name, content, “application/octet-stream”);

0 votes



The MIME type should be provided by the WebDAV client when creating the file, as a normal HTTP request header. If the WebDAV client doesn't do that (and if it doesn't I'd consider it broken) we don't introduce further guessing at the moment.
01/03/2013