fix(IMAP): don't add whitespaces to drafts#12196
fix(IMAP): don't add whitespaces to drafts#12196max65482 wants to merge 1 commit intonextcloud:mainfrom
Conversation
|
Could someone review? |
|
Thanks for your pr 👍 So, it's not the regex that you mentioned in the issue? |
76fb4f9 to
19d46fd
Compare
Yes, I was wrong. The regex is innocent. |
19d46fd to
90bcbf4
Compare
|
Failed integration tests should be fixed now. |
Signed-off-by: Maximilian Martin <maximilian_martin@gmx.de>
ad2cf9f to
4c97bd8
Compare
|
Thanks a lot for your PR 👍 Sorry that the review takes so long 🙈 Your change works. The commits b6d019b / https://github.com/nextcloud/mail/blame/c55f4d6f633b2865a2ecb16a30abdeddd1d4424c/lib/message.php doesn't give me any hint why the newlines were added. I'd hope @ChristophWurst has an idea? |
There was a problem hiding this comment.
Pull request overview
This PR adjusts how ImapMessageFetcher concatenates MIME part bodies so it only inserts separators between parts (instead of always appending trailing \n\n / <br><br>), and updates the integration tests to match the new plaintext body output.
Changes:
- Update plain-text body concatenation to avoid unconditional trailing
\n\nand stop trimming part contents. - Update HTML body concatenation to avoid unconditional trailing
<br><br>. - Update integration test expectations for
getPlainBody()newline behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lib/IMAP/ImapMessageFetcher.php |
Changes how plaintext/HTML bodies are appended, inserting separators only when previous content exists. |
tests/Integration/IMAP/ImapMessageFetcherIntegrationTest.php |
Adjusts assertions to match the updated body formatting (no unconditional trailing blank lines). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ($p[0] === 'message') { | ||
| $data = $this->loadBodyData($p, $partNo, $isFetched); | ||
| $this->plainMessage .= trim($data) . "\n\n"; | ||
| if (!empty($this->plainMessage)) { |
| if (!empty($this->plainMessage)) { | ||
| $this->plainMessage .= "\n\n"; | ||
| } | ||
| $this->plainMessage .= $data; |
| $this->hasHtmlMessage = true; | ||
| $data = $this->loadBodyData($p, $partNo, $isFetched); | ||
| $this->htmlMessage .= $data . '<br><br>'; | ||
| if (!empty($this->htmlMessage)) { |
|
@max65482 mind to have a look at copilot's suggestions? Rebase against latest main would also be nice. |
Fixes #12190