Merge pull request #82 from Xethron/fix-attachment-encoding

Fix attachment encoding bug introduced in 6f09bdc2
This commit is contained in:
Robert Hafner 2014-09-24 17:03:42 -07:00
commit 04600acf8d

View File

@ -194,23 +194,23 @@ class Attachment
{
$dirname = dirname($path);
if (file_exists($path)) {
if (!is_writable($path))
if (!is_writable($path)) {
return false;
}
} elseif (!is_dir($dirname) || !is_writable($dirname)) {
return false;
}
if (($filePointer = fopen($path, 'w')) == false)
if (($filePointer = fopen($path, 'w')) == false) {
return false;
}
switch ($this->encoding) {
case 3:
case 'base64':
case 3: //base64
$streamFilter = stream_filter_append($filePointer, 'convert.base64-decode', STREAM_FILTER_WRITE);
break;
case 4:
case 'quoted-printable':
case 4: //quoted-printable
$streamFilter = stream_filter_append($filePointer, 'convert.quoted-printable-decode', STREAM_FILTER_WRITE);
break;