escape html characters in web console output

This commit is contained in:
RaidMax 2022-04-25 10:43:16 -05:00
parent d462892467
commit 3ad4aa2196

View File

@ -13,7 +13,7 @@
hideLoader(); hideLoader();
response.map(r => r.response).forEach(item => { response.map(r => r.response).forEach(item => {
$('#console_command_response').append(`<div>${item}</div>`); $('#console_command_response').append(`<div>${escapeHtml(item)}</div>`);
}) })
$('#console_command_response').append('<hr/>') $('#console_command_response').append('<hr/>')
@ -26,7 +26,7 @@
if (response.status < 500) { if (response.status < 500) {
response.responseJSON.map(r => r.response).forEach(item => { response.responseJSON.map(r => r.response).forEach(item => {
$('#console_command_response').append(`<div class="text-danger">${item}</div>`); $('#console_command_response').append(`<div class="text-danger">${escapeHtml(item)}</div>`);
}) })
} else { } else {
$('#console_command_response').append(`<div class="text-danger">Could not execute command...</div>`); $('#console_command_response').append(`<div class="text-danger">Could not execute command...</div>`);