Unreadable attachments after import
Some attachment types are unreadable after pilerimport
ing them from EML files. This affects at least .doc, .docx, .xls and .xlsx files. Images seems to be fine.
Tried with both; encrypt_messages
and extract_attachments
set to 1 and to 0.
After wiping the whole installation and importing a single mail with one attachment, i have the following files: 4000000055e5c005194f8f9400f5502822a9.m
and 4000000055e5c005194f8f9400f5502822a9.a1
After unzlib
ing them, i have a mail in *.m1 and the multipart body of the attachment in the .a1 file.
So maybe this is just a problem in the WebUI. In attachment.php:
header("Cache-Control: public, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"" . $this->data['attachment']['filename'] . "\"");
header("Content-Transfer-Encoding: binary\n");
print $this->data['attachment']['attachment'];
I think there should be a decode of the multi part body or something?
Comments (7)
-
reporter -
repo owner Thanks for the diff, I'll review it soon. Can you check the demo site (http://www.mailpiler.org/wiki/demo) and type
a: word OR excel
and check a few docx or xlsx files if they also suffer the problem. Also make sure you double check config-site.php for trailing (or leading ) white characters.
-
reporter The demo site seems to be fine but since extraneous whitespaces might break downloads for other users too, this patch should be merged anyway.
-
repo owner Did you actually have that white character in your config file?
-
reporter Yes
-
repo owner OK, thanks for the clarification. However, in that case we don't really have a bug.
-
repo owner - changed status to invalid
- Log in to comment
After some digging i have found the culprit: Somewhere a newline character is outputted before the actual file contents which makes some filetypes unreadable for applications.
I have opened a PR with a fix: https://bitbucket.org/jsuto/piler/pull-requests/5/fix-for-issue-596/diff