[guile] The message body is duplicated for MIME messages #2802
Description
Describe the item
When the mu:body
message method is called on a MIME message after a call to mu:header
, the body text is duplicated in the returned value.
To Reproduce
With the commits from PR #2801 applied, add the following test to the test-message
function in test-mu-guile.scm
:
(str-equal-or-exit (mu:body msg)
"Hello world, forwarding some RFC822 message\n")
If you add it before the call to mu:header
, it will pass. If you add it after, you get:
not ok /guile/message - ERROR:../guile/tests/test-mu-guile.cc:89:void test_something(const char*): assertion failed: (0)
Bail out!
----------------------------------- stderr -----------------------------------
*ERROR*: Expected "Hello world, forwarding some RFC822 message
", got "Hello world, forwarding some RFC822 message
Hello world, forwarding some RFC822 message
Environment
This is on Guix with Guile 3.0.9.
mu is v1.12.8 with the commits from PR #2801 applied.
Checklist
- [✓] you are running either the latest 1.4.x release, or a 1.5.11+ development release (otherwise, please upgrade).
Analysis
I did some debugging, and I believe the problem happens because mu:c:get-parts
and mu:c:get-header
call Message::unload_mime_message()
at the end.
Because of this, next time Message::load_mime_message()
gets called, priv_->mime_msg
will be empty and fill_document(*priv_)
will add a new instance of the body text in accumulate_text()
.