diff --git a/app/src/helpers/commons.js b/app/src/helpers/commons.js index 768e62c1..7a94f386 100644 --- a/app/src/helpers/commons.js +++ b/app/src/helpers/commons.js @@ -103,6 +103,28 @@ export function arrayDiff (arr1 = [], arr2 = []) { } +/** + * Returns a new string with escaped HTML (`&<>"'` replaced by entities). + * + * @param {String} unsafe + * @return {String} + */ +export function escapeHtml (unsafe) { + return unsafe + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, ''') +} + +/** + * Returns a random integer between `min` and `max`. + * + * @param {Number} min + * @param {Number} max + * @return {Number} + */ export function randint (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min } diff --git a/app/src/views/tool/ToolLog.vue b/app/src/views/tool/ToolLog.vue index 0403c58b..05bf1bee 100644 --- a/app/src/views/tool/ToolLog.vue +++ b/app/src/views/tool/ToolLog.vue @@ -31,7 +31,7 @@
- {{ $t('operation_failed_explanation') }} +
@@ -45,7 +45,7 @@ {{ $t('logs_more') }} @@ -61,7 +61,7 @@