From ed990d96e30cc987b3d315a2d12232e233afe94c Mon Sep 17 00:00:00 2001 From: Artem Stepanov Date: Wed, 26 Oct 2016 16:29:38 +0300 Subject: [PATCH 1/2] Add peek option into Attachment --- src/Fetch/Attachment.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Fetch/Attachment.php b/src/Fetch/Attachment.php index e77984a..992bda2 100644 --- a/src/Fetch/Attachment.php +++ b/src/Fetch/Attachment.php @@ -118,8 +118,8 @@ public function getData() { if (!isset($this->data)) { $messageBody = isset($this->partId) ? - imap_fetchbody($this->imapStream, $this->messageId, $this->partId, FT_UID) - : imap_body($this->imapStream, $this->messageId, FT_UID); + imap_fetchbody($this->imapStream, $this->messageId, $this->partId, FT_UID | FT_PEEK) + : imap_body($this->imapStream, $this->messageId, FT_UID | FT_PEEK); $messageBody = Message::decode($messageBody, $this->encoding); $this->data = $messageBody; @@ -220,8 +220,8 @@ public function saveAs($path) // Fix an issue causing server to throw an error // See: https://github.com/tedious/Fetch/issues/74 for more details - $fetch = imap_fetchbody($this->imapStream, $this->messageId, $this->partId ?: 1, FT_UID); - $result = imap_savebody($this->imapStream, $filePointer, $this->messageId, $this->partId ?: 1, FT_UID); + $fetch = imap_fetchbody($this->imapStream, $this->messageId, $this->partId ?: 1, FT_UID | FT_PEEK); + $result = imap_savebody($this->imapStream, $filePointer, $this->messageId, $this->partId ?: 1, FT_UID | FT_PEEK); if ($streamFilter) { stream_filter_remove($streamFilter); From 733e6b671c12b45c80813f2f29915cb6f2470803 Mon Sep 17 00:00:00 2001 From: Artem Stepanov Date: Tue, 17 Apr 2018 11:12:52 +0300 Subject: [PATCH 2/2] setFileName fix --- .coveralls.yml | 0 .gitignore | 0 .travis.yml | 0 CONTRIBUTING.md | 0 LICENSE | 0 README.md | 0 autoload.php | 0 composer.json | 0 phpunit.xml.dist | 0 src/Fetch/Attachment.php | 2 +- src/Fetch/MIME.php | 0 src/Fetch/Server.php | 0 tests/Fetch/Test/AttachmentTest.php | 0 tests/Fetch/Test/MIMETest.php | 0 tests/Fetch/Test/MessageTest.php | 0 tests/Fetch/Test/ServerTest.php | 0 tests/bootstrap.php | 0 17 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 .coveralls.yml mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .travis.yml mode change 100644 => 100755 CONTRIBUTING.md mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 autoload.php mode change 100644 => 100755 composer.json mode change 100644 => 100755 phpunit.xml.dist mode change 100644 => 100755 src/Fetch/Attachment.php mode change 100644 => 100755 src/Fetch/MIME.php mode change 100644 => 100755 src/Fetch/Server.php mode change 100644 => 100755 tests/Fetch/Test/AttachmentTest.php mode change 100644 => 100755 tests/Fetch/Test/MIMETest.php mode change 100644 => 100755 tests/Fetch/Test/MessageTest.php mode change 100644 => 100755 tests/Fetch/Test/ServerTest.php mode change 100644 => 100755 tests/bootstrap.php diff --git a/.coveralls.yml b/.coveralls.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/autoload.php b/autoload.php old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 diff --git a/phpunit.xml.dist b/phpunit.xml.dist old mode 100644 new mode 100755 diff --git a/src/Fetch/Attachment.php b/src/Fetch/Attachment.php old mode 100644 new mode 100755 index 992bda2..732f148 --- a/src/Fetch/Attachment.php +++ b/src/Fetch/Attachment.php @@ -234,6 +234,6 @@ public function saveAs($path) protected function setFileName($text) { - $this->filename = MIME::decode($text, Message::$charset); + $this->filename = str_replace(DIRECTORY_SEPARATOR, '_', MIME::decode($text, Message::$charset)); } } diff --git a/src/Fetch/MIME.php b/src/Fetch/MIME.php old mode 100644 new mode 100755 diff --git a/src/Fetch/Server.php b/src/Fetch/Server.php old mode 100644 new mode 100755 diff --git a/tests/Fetch/Test/AttachmentTest.php b/tests/Fetch/Test/AttachmentTest.php old mode 100644 new mode 100755 diff --git a/tests/Fetch/Test/MIMETest.php b/tests/Fetch/Test/MIMETest.php old mode 100644 new mode 100755 diff --git a/tests/Fetch/Test/MessageTest.php b/tests/Fetch/Test/MessageTest.php old mode 100644 new mode 100755 diff --git a/tests/Fetch/Test/ServerTest.php b/tests/Fetch/Test/ServerTest.php old mode 100644 new mode 100755 diff --git a/tests/bootstrap.php b/tests/bootstrap.php old mode 100644 new mode 100755