Skip to content

fix(IMAP): don't add whitespaces to drafts#12196

Merged
kesselb merged 1 commit intonextcloud:mainfrom
max65482:fix/whitespaces-in-drafts
Mar 17, 2026
Merged

fix(IMAP): don't add whitespaces to drafts#12196
kesselb merged 1 commit intonextcloud:mainfrom
max65482:fix/whitespaces-in-drafts

Conversation

@max65482
Copy link
Copy Markdown
Contributor

Fixes #12190

@max65482
Copy link
Copy Markdown
Contributor Author

max65482 commented Feb 8, 2026

Could someone review?

@kesselb
Copy link
Copy Markdown
Contributor

kesselb commented Feb 10, 2026

Thanks for your pr 👍

So, it's not the regex that you mentioned in the issue?

@kesselb kesselb force-pushed the fix/whitespaces-in-drafts branch from 76fb4f9 to 19d46fd Compare February 10, 2026 14:35
@max65482
Copy link
Copy Markdown
Contributor Author

So, it's not the regex that you mentioned in the issue?

Yes, I was wrong. The regex is innocent.

@max65482 max65482 force-pushed the fix/whitespaces-in-drafts branch from 19d46fd to 90bcbf4 Compare March 2, 2026 09:57
@max65482
Copy link
Copy Markdown
Contributor Author

max65482 commented Mar 2, 2026

Failed integration tests should be fixed now.

@max65482 max65482 force-pushed the fix/whitespaces-in-drafts branch 2 times, most recently from ad2cf9f to 4c97bd8 Compare March 6, 2026 09:37
@kesselb
Copy link
Copy Markdown
Contributor

kesselb commented Mar 6, 2026

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?

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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\n and 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.

Comment thread lib/IMAP/ImapMessageFetcher.php Outdated
Comment thread lib/IMAP/ImapMessageFetcher.php Outdated
Comment thread lib/IMAP/ImapMessageFetcher.php Outdated
@kesselb
Copy link
Copy Markdown
Contributor

kesselb commented Mar 16, 2026

@max65482 mind to have a look at copilot's suggestions? Rebase against latest main would also be nice.

@max65482 max65482 force-pushed the fix/whitespaces-in-drafts branch from 4c97bd8 to ad044cf Compare March 17, 2026 15:04
@max65482
Copy link
Copy Markdown
Contributor Author

@max65482 mind to have a look at copilot's suggestions? Rebase against latest main would also be nice.

@kesselb Done!

@kesselb kesselb enabled auto-merge March 17, 2026 15:06
@kesselb
Copy link
Copy Markdown
Contributor

kesselb commented Mar 17, 2026

/backport to stable5.7

@max65482
Copy link
Copy Markdown
Contributor Author

It looks like it won't automerge when codecov fails.

@kesselb kesselb disabled auto-merge March 17, 2026 17:41
Signed-off-by: Maximilian Martin <maximilian_martin@gmx.de>
@kesselb kesselb force-pushed the fix/whitespaces-in-drafts branch from ad044cf to d8b4a85 Compare March 17, 2026 17:42
@kesselb kesselb merged commit 7a3da52 into nextcloud:main Mar 17, 2026
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Additional newlines/spaces added to drafts

3 participants