Document files are corrupted after downloading from mattermost

Hello, I am using the latest version of mattermost, I have the following problem:
In the chat channel I send the uploaded file, then in the n8n software I use an http node to download that uploaded file.
Files that have been successfully downloaded as pdf files can be viewed, and they can also be viewed when downloaded to a computer.
However, when the flow runs to the node that uploads that file to the application that converts files to different formats, it reports an error as File format error.
I’m stuck at this part, does anyone have any solution to help me, thank you!

1 Like

Then I used a node function to convert the file back after uploading from mattermost to n8n and was able to handle it, the code is as follows:
Cảm ơn vì bạn đã phản hồi:

const binaryPropertyName = 'data';
const fileName = $('Edit Fields').first().json.filename;
const fileExtention = $('Edit Fields').first().json.fileextension;
const binaryData = items[0].binary[binaryPropertyName];
binaryData['fileName'] = fileName;
binaryData['fileExtension'] = fileExtention;
return [
  {
    json: {},
    binary: {
      [binaryPropertyName]: binaryData
    }
  }
];

Hi @Vietcanhvn! It’s great to see your innovative debugging approach! If the issue persists or you’re looking to further optimize handling file uploads, I’d recommend reviewing this section of the developer docs on file storage to ensure everything aligns with Mattermost’s file handling processes. Let us know if you need more assistance!