1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Desktop: Fixed an issue that could cause certain notes not to render when they contain an empty STYLE tag

This commit is contained in:
Laurent Cozic 2024-05-06 11:28:13 +01:00
parent e73535ace0
commit 0a766d7314
2 changed files with 14 additions and 1 deletions

View File

@ -32,6 +32,19 @@ describe('HtmlToHtml', () => {
css: '', 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) { for (const t of testCases) {

View File

@ -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 // 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 // HtmlToHtml class and used by the Rich Text editor, and that's with the STYLE