03-31-2017 06:07 AM
I have an empty document. Only metadata are filled.
I want to upload new version of document, e.g. newFile.docx.
It is OK.
But.
The mime type is bin(application/octet-stream).
It's a bug? Or where is a problem? I'm really confused.
Alfresco Community 5.1
03-31-2017 06:17 AM
I think the repository doesn't do a second guess of the mime type if you create a new version.
You say, you have an empty document. Do know the mime type beforehand and are able to set it like you did with the rest of the metadata?
Another possibility would be a script executed by a rule on "incoming document".
Maybe an adapted scripts like in alfresco - convert docx to pdf and create a new version could help
04-04-2017 07:22 AM
Thank for your answer.
So, Alfresco create a .bin extension and it is bin to the end of days? Hm, not very clever.
I do not know extension beforehand.
My solution is a Java class:
ContentReader contentReader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
String type = mimetypeService.guessMimetype(null, contentReader);
String extension = mimetypeService.getExtension(type);
But, it's not running with type .accdb or .txt. Why?
04-04-2017 08:01 AM
I think alfresco just lacks the mimetype for MS Access accdb files.
/thread/182405-doesnt-alfresco-handle-ms-access-files
Axel Faust commented on this.
The mimetype service is also able to guess the mimetype from the extension
mimetypeService.getMimetypesByExtension().get(extension);
It might be not very clever not to check and set the mimetype on new versions, but most likely you change a documents content, not its name and mimetype. So because your case is quite unusual, you won't find a out of the box solution.
I had such a case when metadata was waiting for files from a legacy application and solved it with a incoming rule, executing a short JavaScript...
you can add mimetypes to Alfresco: Adding a MIME type | Alfresco Documentation
10-04-2017 02:17 PM
This behaviour was changed in the 201702-GA release (Alfresco Content Repository 5.2.f and Alfresco Share 5.2.e)
Details here [ALF-21813] MIME type does not change when the content is changed - Alfresco JIRA
Explore our Alfresco products with the links below. Use labels to filter content by product module.