Skip to content

Fix formatting of Upcoming Audit Email Body #17273

@yusuf-basith

Description

@yusuf-basith

The Asset Notes field included in the Upcoming Audit Email is a multi-line text field. Hence there is a high chance of having a line break in this field.

Currently, the asset notes are passed as it is in the blade templates to the markdown format, which leads to broken HTML table in the final email, when there are line breaks.

Vibe coding with GIthub copilot shows that we can use $escaped_notes = nl2br(e($asset->notes)); to convert the new lines in the asset notes to <br> tag, which is one of the known ways to manage multi-line cells in markdown tables.

Copilot also told to use {!! $escaped_notes !!} while inserting it in the table to escape HTML tags.
While trying to understand the code, it told about XSS vulnerabilities. So I let the professionals deal with the right way of working.

Image

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions