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
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
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?
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
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
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.