lib/kolab_sync_message.php tests/src

Aleksander Machniak machniak at kolabsys.com
Sun Oct 14 15:41:09 CEST 2012


 lib/kolab_sync_message.php |    7 +++++--
 tests/src/mail.mixed       |    2 +-
 tests/src/mail.plain.mixed |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit b177444b656c8e1f284dd4c6c8e6cef96a6f0400
Author: Aleksander Machniak <alec at alec.pl>
Date:   Sun Oct 14 15:40:35 2012 +0200

    Fix chandling of closing boundary when adding attachment to the message

diff --git a/lib/kolab_sync_message.php b/lib/kolab_sync_message.php
index a31a6c1..63dfc10 100644
--- a/lib/kolab_sync_message.php
+++ b/lib/kolab_sync_message.php
@@ -123,10 +123,13 @@ class kolab_sync_message
             $body['headers'][$name] = $name . ': ' . $value;
         }
 
+        $this->body = rtrim($this->body);
+        $this->body = preg_replace('/--$/', '', $this->body);
+
         // add the attachment to the end of the message
-        $this->body = rtrim($this->body) . "\r\n"
+        $this->body .= "\r\n"
             .implode("\r\n", $body['headers']) . "\r\n\r\n"
-            .$body['body'] . "\r\n--$boundary\r\n";
+            .$body['body'] . "\r\n--$boundary--\r\n";
     }
 
     /**
diff --git a/tests/src/mail.mixed b/tests/src/mail.mixed
index be5f4fb..1925e2b 100644
--- a/tests/src/mail.mixed
+++ b/tests/src/mail.mixed
@@ -21,4 +21,4 @@ Content-Transfer-Encoding: base64
 Content-Type: text/plain
 
 YWFh
---BOUNDARY
+--BOUNDARY--
diff --git a/tests/src/mail.plain.mixed b/tests/src/mail.plain.mixed
index e7bc4e2..0633899 100644
--- a/tests/src/mail.plain.mixed
+++ b/tests/src/mail.plain.mixed
@@ -16,4 +16,4 @@ Content-Transfer-Encoding: 8bit
 Content-Type: text/plain
 
 aaa
---BOUNDARY
+--BOUNDARY--





More information about the commits mailing list