Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Contribution Guidelines

What does this PR include?

Short Description

The UI footer field accumulated <br /> tags on each save due to nl2br() converting newlines during display while persisting the converted HTML. Removed the conversion—users control their own HTML in a field labeled "HTML allowed".

Before:

  1. Load: nl2br() converts \n<br />
  2. Display in textarea: shows Line 1<br />
  3. Save: stores Line 1<br /> to Redis
  4. Next load: nl2br() converts to Line 1<br /><br />

After:
Content flows through unchanged. Users add <br> tags explicitly if needed.

Affected Containers

  • web (PHP)

Did you run tests?

What did you tested?

  • PHP syntax validation
  • Code review (automated)
  • CodeQL security scan

What were the final results? (Awaited, got)

All validation passed. No security issues introduced. Existing footer content with accumulated tags remains stable but won't accumulate further.

Original prompt

This section details on the original issue you should resolve

<issue_title>Newlines repeatedly added to UI Footer on save</issue_title>
<issue_description>### Contribution guidelines

Checklist prior issue creation

  • I understand that failure to follow below instructions may cause this issue to be closed.
  • I understand that vague, incomplete or inaccurate information may cause this issue to be closed.
  • I understand that this form is intended solely for reporting software bugs and not for support-related inquiries.
  • I understand that all responses are voluntary and community-driven, and do not constitute commercial support.
  • I confirm that I have reviewed previous issues to ensure this matter has not already been addressed.
  • I confirm that my environment meets all prerequisite requirements as specified in the official documentation.

Description

Every time the UI footer html is saved, the backend adds <br /> at the end of every line. This modified version is now the new content. When clicking save again, it will add <br />s again. This is incredibly annoying, especially if you just want to edit one of the other inputs that share the same submit button (eg. Announcement text).

Steps to reproduce:

  1. Log in as admin
  2. Go to System > Configuration > Options > Customize
  3. At the bottom of the page, enter mutiple lines into Footer (HTML allowed):
  4. Save
  5. Note that <br />s have been added to the end of every line
  6. Save again
  7. Note that another set of <br />s has been added

Initial input:
Image

After 1st save:
Image

After 2nd save:
Image

After 3rd save:
Image

Which branch are you using?

master (stable)

mailcow version:

2025-09c
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix newlines repeatedly added to UI footer on save Fix: Remove nl2br() causing repeated <br /> tag accumulation in UI footer Dec 15, 2025
Copilot AI requested a review from DerLinkman December 15, 2025 11:29
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.

2 participants