I attached a file with a task and fetched its content using
runtime/tasks/{taskId}/attachment/{attachmentId}/content
api. I am able to save content of text file successfully but for other formats data is not getting saved properly and saved files are getting corrupted.
I am trying to fetch content of attached files using api call on activiti version 5.22.0. For "text" files, I am able to save content in a local file but for rest of the formats (.pdf/ .jpeg), I am not getting proper content as the local files are getting corrupted and also size of local file is larger than the original file.
Can you elaborate though? I want to know things like, "when I use this file (size, type, etc), the API call works, but then I download the file and <something> happens". Are there any error messages? Does this seem to happen to all files other than text no matter what? Or does it work for smaller/larger files?
-JEarles
This is what I have found.
1. I am able to reproduce the issue using a simple pdf file.
2. The corruptions appears to occur on upload as the binary stream stored in the database matches the corrupted file.
3. Activiti Enterprise and Activiti Version 6 use a completely different API set and doesnt appear to have the same problem, at least using the new related content api.
The code itself appears to be correct, the Multipart data element is being pulled directly from the request using:
MultipartFile file = request.getFileMap().values().iterator().next();
Then saved to the ACT_GE_BYTEARRAY table as a byte array. The Data is wrong as soon as it hits the database.
I have not attempted using any other file, but right now things don't look good.
Greg
Greg
As you said that this problem will not occur in Activiti Version 6, but is there any possibility that I can get correct content using Activiti Version 5.22 as migrating from version 5.22 to 6 will require major changes for us.
Activiti is open source software and maintained by the usr community.
Feel free to generate a fix and issue a pull request.
If you are incapable of unwilling to contribute, you can open a defect on the Activiti Jira here, but there is no guarantee when this will be fixed that way.
Alternatively, if this is really important to you, you could pay someone to fix the issue for you (such as BP3).
Greg
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
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.