Skip to content

Commit

Permalink
Desktop: Fixed an issue that could cause certain notes not to render …
Browse files Browse the repository at this point in the history
…when they contain an empty STYLE tag
  • Loading branch information
laurent22 committed May 6, 2024
1 parent e73535a commit 0a766d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/renderer/HtmlToHtml.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ describe('HtmlToHtml', () => {
css: '',
},
],
// cSpell:disable
[
`<style></style>
<p><br></p><div class="moz-forward-container"><br><br>-------- Message transféré --------<table class="moz-email-headers-table" cellspacing="0" cellpadding="0" border="0"><tbody><tr><th valign="BASELINE" nowrap="nowrap" align="RIGHT">Sujet&nbsp;:</th><td>
Your car rental booking DC-7706328 is confirmed (pick-up on 1 October 2024)</td></tr></tbody></table><style type="text/css"></style>`,
{
html: `
<p><br></p><div class="moz-forward-container"><br><br>-------- Message transféré --------<table class="moz-email-headers-table" cellspacing="0" cellpadding="0" border="0"><tbody><tr><th valign="BASELINE" nowrap="nowrap" align="RIGHT">Sujet&nbsp;:</th><td>
Your car rental booking DC-7706328 is confirmed (pick-up on 1 October 2024)</td></tr></tbody></table><style type="text/css"></style>`,
css: '',
},
],
// cSpell:enable
];

for (const t of testCases) {
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/HtmlToHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default class HtmlToHtml implements MarkupRenderer {
}
}

const splitHtmlRegex = /^<style>([\s\S]*)<\/style>([\s\S]*)$/i;
const splitHtmlRegex = /^<style>([\s\S]*?)<\/style>([\s\S]*)$/i;

// This function is designed to handle the narrow case of HTML generated by the
// HtmlToHtml class and used by the Rich Text editor, and that's with the STYLE
Expand Down

0 comments on commit 0a766d7

Please sign in to comment.