03-01-2017 08:21 AM
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.
03-01-2017 08:52 AM
03-01-2017 11:34 PM
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.
03-02-2017 12:42 PM
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
03-02-2017 02:32 PM
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
03-03-2017 04:35 AM
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.
03-03-2017 07:37 AM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.