Page 1 of 1

Downloading email attachments fails

PostPosted:Fri May 29, 2020 6:14 pm
by tbclark3
I uploaded about 4000 individual eml files to an openkm installation, and they appear to have been parsed and indexed correctly. When I click on one of them with an attachment, and look at the preview window, I correctly see the message contents and a list of attachments. However, when I click on any one of the attachments, it starts a download but never finishes. Every time, the browser gets almost to the end of the download, says that the download failed, and starts over.

However, if I copy the "incomplete" file just before the browser fails and compare it to the version in the openkm repository, it is identical. Also, if I right click and copy the attachment to another location within openkm, I can preview it or download it successfully. Thus the problem seems to be that the browser thinks the file is bigger than it actually is. The difference is not constant, but is usually not very much.

I would be happy to further troubleshoot this problem, but I'm not sure where to start.

Re: Downloading email attachments fails

PostPosted:Sat May 30, 2020 12:29 am
by tbclark3
Additional info:

After spending some time analyzing HTTP headers, it is clear that the openkm server is returning an incorrect Content-Length. In every case it is bigger than the actual document.

Re: Downloading email attachments fails

PostPosted:Sat May 30, 2020 6:53 pm
by jllort
What is the real content lenght of these attachments ?
Can you share some eml for testing in our development environment.
Finally what OpenKM version are you using?

Re: Downloading email attachments fails

PostPosted:Sun May 31, 2020 2:45 am
by tbclark3
I am using version 6.3.9 in Docker.

I created the attached email and uploaded it to my openkm instance. Both of the attachments fail to download because the server provides the wrong content-length. I had to rename the attached email from flowermail.eml to flowermail.eml.pdf because your server doesn't allow upload of .eml extensions. In order to recreate the problem, you will obviously have to rename it to flowermail.eml before uploading it to an openkm instance.

It doesn't make any difference what type of file the attachment is. And, again, downloading the entire email works. It only fails when downloading individual attachments from the Preview tab.

Attachment: flower1.jpeg
Actual length: 21846
Header Content-Length provided by server: 29936

Attachment: flower2.jpg
Actual length: 19566
Header Content-Length provided by server: 26812

Re: Downloading email attachments fails

PostPosted:Sun May 31, 2020 8:23 am
by jllort
It seems and issue. Please add the issue at https://github.com/openkm/document-mana ... tem/issues ( upload there the eml file and also please add the link to this forum post ).