escaping html code also in chatgpt web integration. see #711

This commit is contained in:
mic 2026-03-26 23:41:13 +01:00
parent 36d606bbc6
commit 63f52703b7

View file

@ -285,10 +285,19 @@ function convertBrToNewlines(html) {
export function convertNewlinesToParagraphs(input) {
return input
.split('\n')
.map(line => `<p>${line}</p>`)
.map(line => `<p>${escapeHtml(line)}</p>`)
.join('');
}
function escapeHtml(text) {
return text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}
// This method is used to convert the model string id used in the URL
// to the model string used in the webpage