Mailed database backups have mal-formed attachments

markdionne - December 18, 2006 - 02:47
Project:Database Administration
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Wnen emailed database backups generated by dba automatic backups arrive, the attachment has a null file name associated with it. The following code change seems to fix it. The main change is the addition of the "Content Disposition" line.

function build_message($part) {
$message = $part["message"];
$message = chunk_split(base64_encode($message));
$encoding = "base64";
$pre = "Content-Type: ".$part["ctype"].($part["name"]? "; name = \"".$part["name"]."\"" : "");
if ($part["name"]) $pre .= "\nContent-Disposition: attachment; filename=\"".$part["name"]."\"";
return $pre."\nContent-Transfer-Encoding: $encoding\n\n$message\n";
}

#1

dww - January 2, 2007 - 06:38

again, can you attach a patch for this? it'll make it easier to review and commit if/when appropriate. see http://drupal.org/diffandpatch and/or http://drupal.org/patch for more details.

thanks!
-derek

#2

greggles - April 3, 2008 - 19:42
Version:4.7.x-1.0» 5.x-1.x-dev
Status:active» needs review

I haven't tested this (yet) but at least here's a patch.

AttachmentSize
dba-attachment-style-103906-2.patch 1 KB

#3

greggles - April 4, 2008 - 23:41

Yep, this has fixed it for the last few backup emails that I've received. I'd say it's RTBC, but didn't step through the code line by line and don't know enough about mail headers to say for sure... allI know is that before I got "unnamed" attachments and now they are named.

 
 

Drupal is a registered trademark of Dries Buytaert.