掲示板

Inconsistent Mime Type assigned for documents uploaded via API

7年前 に Ragunath A によって更新されました。

Inconsistent Mime Type assigned for documents uploaded via API

New Member 投稿: 5 参加年月日: 16/09/22 最新の投稿
Hi,

In our application, we have provided pages for the user to upload the document directly into documents & media using Liferay DLFileEntry APIs. We allow users to upload macro enabled xls files. In one environment the uploaded file is stored with mimetype "application/vnd.ms-excel.sheet.macroenabled.12" whereas in the other environment where the same code is deployed, the mime type is saved as "application/vnd.ms-excel.sheet.macroEnabled.12". I can see the differences in Lifeary DLFILEENTRY_ table mimetype column.

I'm using MimeTypesUtil.getContentType(sourceFileName) to find out the mime type of the document by passing the file name with extension xlsm.

The tika-core.jar which holds the mime mappings xml is same on both of these environments that has entry "application/vnd.ms-excel.sheet.macroenabled.12" for xlsm extension. Not sure is there any other jar which has overrides that is causing this incosistency. Any help with figuring out the root cause is appreciated.
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: Inconsistent Mime Type assigned for documents uploaded via API

Liferay Legend 投稿: 14917 参加年月日: 06/09/02 最新の投稿
Hmm, IIRC isn't mime type provided by the browser during upload? Could you be looking at perhaps a difference between browsers?





Come meet me at the LSNA!
7年前 に Ragunath A によって更新されました。

RE: Inconsistent Mime Type assigned for documents uploaded via API

New Member 投稿: 5 参加年月日: 16/09/22 最新の投稿
Thanks for your reply.

When I debug the post request in firebug, the mime-type is sent as "application/vnd.ms-excel.sheet.macroEnabled.12" for both of the environment urls. In our code we are using the MimeTypesUtil to find out the mime type instead of trusting browser sent value, as there are chances that different browsers will provide different values.

Need to figure out why the MimeTypesUtil is returning different values.