Skip to content

Commit

Permalink
fix(backend): attachments with PDF files (and probably other subtypes…
Browse files Browse the repository at this point in the history
… under the application type) (#1442)
  • Loading branch information
mercihabam authored Feb 6, 2025
1 parent 13e3a96 commit 18965ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/smtp/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ public function process() {
foreach ($msg_struct[0]['subs'] as $ind => $sub) {
if ($ind != '0.1') {
$new_attachment['basename'] = $sub['description'];
$new_attachment['name'] = $sub['attributes']['name'];
$new_attachment['name'] = $sub['attributes']['name'] ?? $sub['attributes']['filename']; // some file types (i.e. pdf) use the filename attribute instead of name.
$new_attachment['size'] = $sub['size'];
$new_attachment['type'] = $sub['type'];
$new_attachment['type'] = $sub['type'] . "/" . $sub['subtype'];
$file_path = $file_dir . $new_attachment['name'];
$content = Hm_Crypt::ciphertext($mailbox->get_message_content(hex2bin($path[2]), $this->request->get['uid'], $ind), Hm_Request_Key::generate());
file_put_contents($file_path, $content);
Expand Down

0 comments on commit 18965ef

Please sign in to comment.