How can i get around Mimetype mismatch from saving files from SharePoint

Oscar Toohey
Tera Contributor

Hi all,

I understand this question has been asked quite a few times on here.

I want to get files from SharePoint and save them as attachments on a record. It's all working except for .msg file types when it sometimes errors "Expected type:application/vnd.ms-outlook, Actual type: application/x-tika-msoffice", or " Expected type:application/vnd.ms-outlook, Actual type: application/octet-stream".

This is the code that is used to get the file and save it as an attachment.

find_real_file.png

This is the rest frame work the above leverages.

find_real_file.png

I've already tried taking msg file extension from the glide.attachment.extensions because that is suppose to stop glide.security.file.mime_type.validation from checking the file type but this has worked to no avail.

Turning off glide.security.file.mime_type.validation is not an option for us for the obvious security concerns.

I've looked at this license and I'd prefer to not buy another license but if someone knows this works in this or similar application please let me know.

I've heard that sometimes the web can ruin the mimetype of a file and leaves it blank hence octet stream error. 

Is there another way to get the get a file and check if the mimetype is wrong. Then insert it into the sys_attachment table and force it to be a msg file? Open to any suggestions.

Cheers,

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi

I have attached a knowledge article which describes how to handle such errors.

Maik

Modifying the glide.security.mime_type.aliasset property for .har files resolved the issue.
e.g. application/octet-stream=text/plain