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 e77984a..732f148 --- 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); @@ -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