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

This commit is contained in:
mic 2026-03-26 23:41:13 +01:00 committed by Mic
parent 1d8543627e
commit 5301d1c898

View file

@ -285,10 +285,19 @@ function convertBrToNewlines(html) {
export function convertNewlinesToParagraphs(input) { export function convertNewlinesToParagraphs(input) {
return input return input
.split('\n') .split('\n')
.map(line => `<p>${line}</p>`) .map(line => `<p>${escapeHtml(line)}</p>`)
.join(''); .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 // This method is used to convert the model string id used in the URL
// to the model string used in the webpage // to the model string used in the webpage