mirror of
https://github.com/theonedev/onedev.git
synced 2025-12-08 18:26:30 +00:00
Escape html markup in log message
This commit is contained in:
parent
ce57390f71
commit
649e012095
@ -32,7 +32,6 @@ import org.joda.time.format.DateTimeFormat;
|
|||||||
import org.joda.time.format.DateTimeFormatter;
|
import org.joda.time.format.DateTimeFormatter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.unbescape.html.HtmlEscape;
|
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
@ -156,7 +155,7 @@ public class DefaultLogManager implements LogManager {
|
|||||||
try {
|
try {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
for (String line: Splitter.on(EOL_PATTERN).split(Throwables.getStackTraceAsString(throwable)))
|
for (String line: Splitter.on(EOL_PATTERN).split(Throwables.getStackTraceAsString(throwable)))
|
||||||
message += "\n " + HtmlEscape.escapeHtml5(line);
|
message += "\n " + line;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.startsWith(LogInstruction.PREFIX)) {
|
if (message.startsWith(LogInstruction.PREFIX)) {
|
||||||
|
|||||||
@ -8,11 +8,13 @@ onedev.server.buildLog = {
|
|||||||
onedev.server.buildLog.appendLogEntries(containerId, logEntries, maxNumOfLogEntries);
|
onedev.server.buildLog.appendLogEntries(containerId, logEntries, maxNumOfLogEntries);
|
||||||
},
|
},
|
||||||
renderLogEntry: function(logEntry) {
|
renderLogEntry: function(logEntry) {
|
||||||
return "<div class='log-entry " + logEntry.level + "'>" +
|
var $logEntry = $("<div class='log-entry " + logEntry.level + "'></div>");
|
||||||
"<span class='date'>" + moment(logEntry.date).format("HH:mm:ss") + "</span>" +
|
$logEntry.append("<span class='date'>" + moment(logEntry.date).format("HH:mm:ss") + "</span>");
|
||||||
"<span class='log-level'>" + logEntry.level + "</span>" +
|
$logEntry.append("<span class='log-level'>" + logEntry.level + "</span>");
|
||||||
"<span class='message'>" + logEntry.message + "</span>" +
|
var $message = $("<span class='message'></span>");
|
||||||
"</div>";
|
$message.text(logEntry.message);
|
||||||
|
$logEntry.append($message);
|
||||||
|
return $logEntry;
|
||||||
},
|
},
|
||||||
appendLogEntries: function(containerId, logEntries, maxNumOfLogEntries) {
|
appendLogEntries: function(containerId, logEntries, maxNumOfLogEntries) {
|
||||||
var $buildLog = $("#" + containerId + ">.build-log");
|
var $buildLog = $("#" + containerId + ">.build-log");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user