Skip to content

Commit

Permalink
Merge pull request #2361 from qorelanguage/bugfix/2360_mail_message_fix
Browse files Browse the repository at this point in the history
refs #2360 fixed Message::addBody() with no body
  • Loading branch information
Ondrej Musil committed Oct 31, 2017
2 parents d043251 + 34ab1c2 commit 362b40b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doxygen/lang/900_release_notes.dox.tmpl
Expand Up @@ -14,6 +14,8 @@
- fixed incorrect flex code regarding parse options leading to segfaults (<a href="https://github.com/qorelanguage/qore/issues/2262">issue 2262</a>)
- <a href="../../modules/DebugCmdLine/html/index.html">DebugCmdLine</a> module fixes:
- fixed value setting to process all remaining arguments on the command line (<a href="https://github.com/qorelanguage/qore/issues/2294">issue 2294</a>)
- <a href="../../modules/MailMessage/html/index.html">MailMessage</a> module fixes:
- fixed \c Message::addBody() with no body present (issue <a href="https://github.com/qorelanguage/qore/issues/2360">issue 2360</a>)
- <a href="../../modules/Qdx/html/index.html">Qdx</a> module fixes:
- fixed a bug in documentation post-processing for @ref hashdecl "hashdecl" declarations (<a href="https://github.com/qorelanguage/qore/issues/2298">issue 2298</a>)
- <a href="../../modules/RestHandler/html/index.html">RestHandler</a> module fixes:
Expand Down
8 changes: 8 additions & 0 deletions examples/test/qlib/MailMessage/MailMessage.qtest
Expand Up @@ -99,5 +99,13 @@ lorem ipsum\r
assertEq(refstr.split("\r\n"), r.split("\r\n"));
#assertEq(refstr, r);
}
{
# test issue #2360
Message msg(Sender, Subject);
msg.addBody("body");
msg.addTO(To);
string r = msg.serialize();
assertRegex("Content-Transfer-Encoding: quoted-printable", r);
}
}
}
12 changes: 11 additions & 1 deletion qlib/MailMessage.qm
Expand Up @@ -40,7 +40,7 @@
%enable-all-warnings

module MailMessage {
version = "1.3";
version = "1.3.1";
desc = "defines the MailMessage class and supporting definitions";
author = "David Nichols <david@qore.org>";
url = "http://qore.org";
Expand Down Expand Up @@ -74,6 +74,9 @@ msg.addTO("My Best Friend <you@friend.com>");

@section mailmessage_relnotes MailMessage Release Notes

@subsection mailmessage_v1_3_1
- fixed @ref MailMessage::Message::addBody() "Message::addBody()" with no body present (issue <a href="https://github.com/qorelanguage/qore/issues/2360">issue 2360</a>)

@subsection mailmessage_v1_3
- added support for complex types

Expand Down Expand Up @@ -577,6 +580,10 @@ m.addHeader("Message-ID: <20090712.123456789@mail.drei.at>");@endcode
addBody(string str) {
if (body.typeCode() == NT_BINARY)
throw "BODY-ERROR", sprintf("cannot concatenate a string to a binary body");
# issue #2360 check if encoding is set
if (bodyEncoding == EncDefault)
bodyEncoding = EncQuotedPrintable;

body += str;
}

Expand All @@ -588,6 +595,9 @@ m.addHeader("Message-ID: <20090712.123456789@mail.drei.at>");@endcode
addBody(binary bin) {
if (body.typeCode() == NT_STRING)
throw "BODY-ERROR", sprintf("cannot concatenate a binary object to a string body");
# issue #2360 check if encoding is set
if (bodyEncoding == EncDefault)
bodyEncoding = EncBase64;
body += bin;
}

Expand Down

0 comments on commit 362b40b

Please sign in to comment.