03-01-2017 05: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 05:52 AM
03-01-2017 08: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 09:42 AM
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 11:32 AM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.