1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

B : VM log doesn't escape markup characters ()

This commit is contained in:
Abel Coronado 2018-03-16 17:09:50 +01:00 committed by Tino Vázquez
parent bcbd53c259
commit d6aaf49a68

@ -29,8 +29,8 @@ define(function(require) {
var TAB_ID = require("../tabId");
var PANEL_ID = require("./log/panelId");
var RESOURCE = "VM"
var XML_ROOT = "VM"
var RESOURCE = "VM";
var XML_ROOT = "VM";
/*
CONSTRUCTOR
@ -80,7 +80,7 @@ define(function(require) {
var log_lines = response["vm_log"].split("\n");
var colored_log = "";
for (var i = 0; i < log_lines.length; i++) {
var line = log_lines[i];
var line = escapeHtml(log_lines[i]);
if (line.match(/\[E\]/)) {
line = "<span class=\"vm_log_error\">" + line + "</span>";
}
@ -93,7 +93,7 @@ define(function(require) {
colored_log +
"</div>" +
"</div>");
$(".vm_log_container", context).animate({scrollTop: $('.vm_log_container').prop("scrollHeight")}, "slow");
$(".vm_log_container", context).animate({scrollTop: $(".vm_log_container", context).prop("scrollHeight")}, "slow");
},
error: function(request, error_json) {
@ -110,4 +110,13 @@ define(function(require) {
}
});
}
function escapeHtml(log_line) {
return log_line
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
});