Fix /echo command falsely stripping HTML-like text
This commit is contained in:
parent
a3dbcf3c2a
commit
e7ab43527a
|
@ -1940,8 +1940,8 @@ async function generateCallback(args, value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function echoCallback(args, value) {
|
async function echoCallback(args, value) {
|
||||||
const safeValue = DOMPurify.sanitize(String(value) || '');
|
// Note: We don't need to sanitize input, as toastr is set up by default to escape HTML via toastr options
|
||||||
if (safeValue === '') {
|
if (value === '') {
|
||||||
console.warn('WARN: No argument provided for /echo command');
|
console.warn('WARN: No argument provided for /echo command');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1949,17 +1949,17 @@ async function echoCallback(args, value) {
|
||||||
const severity = args?.severity !== undefined && typeof args?.severity === 'string' ? args.severity : 'info';
|
const severity = args?.severity !== undefined && typeof args?.severity === 'string' ? args.severity : 'info';
|
||||||
switch (severity) {
|
switch (severity) {
|
||||||
case 'error':
|
case 'error':
|
||||||
toastr.error(safeValue, title);
|
toastr.error(value, title);
|
||||||
break;
|
break;
|
||||||
case 'warning':
|
case 'warning':
|
||||||
toastr.warning(safeValue, title);
|
toastr.warning(value, title);
|
||||||
break;
|
break;
|
||||||
case 'success':
|
case 'success':
|
||||||
toastr.success(safeValue, title);
|
toastr.success(value, title);
|
||||||
break;
|
break;
|
||||||
case 'info':
|
case 'info':
|
||||||
default:
|
default:
|
||||||
toastr.info(safeValue, title);
|
toastr.info(value, title);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|
Loading…
Reference in New Issue