mirror of
https://github.com/retailcrm/Fetch.git
synced 2024-11-22 11:16:03 +03:00
Merge pull request #82 from Xethron/fix-attachment-encoding
Fix attachment encoding bug introduced in 6f09bdc2
This commit is contained in:
commit
04600acf8d
@ -194,28 +194,28 @@ class Attachment
|
|||||||
{
|
{
|
||||||
$dirname = dirname($path);
|
$dirname = dirname($path);
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
if (!is_writable($path))
|
if (!is_writable($path)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
} elseif (!is_dir($dirname) || !is_writable($dirname)) {
|
} elseif (!is_dir($dirname) || !is_writable($dirname)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($filePointer = fopen($path, 'w')) == false)
|
if (($filePointer = fopen($path, 'w')) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($this->encoding) {
|
switch ($this->encoding) {
|
||||||
case 3:
|
case 3: //base64
|
||||||
case 'base64':
|
$streamFilter = stream_filter_append($filePointer, 'convert.base64-decode', STREAM_FILTER_WRITE);
|
||||||
$streamFilter = stream_filter_append($filePointer, 'convert.base64-decode', STREAM_FILTER_WRITE);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
case 4: //quoted-printable
|
||||||
case 'quoted-printable':
|
$streamFilter = stream_filter_append($filePointer, 'convert.quoted-printable-decode', STREAM_FILTER_WRITE);
|
||||||
$streamFilter = stream_filter_append($filePointer, 'convert.quoted-printable-decode', STREAM_FILTER_WRITE);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$streamFilter = null;
|
$streamFilter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = imap_savebody($this->imapStream, $filePointer, $this->messageId, $this->partId ?: 1, FT_UID);
|
$result = imap_savebody($this->imapStream, $filePointer, $this->messageId, $this->partId ?: 1, FT_UID);
|
||||||
|
Loading…
Reference in New Issue
Block a user