From 5184c67ffb4863cc36687ea0307a43a611ca3c3f Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Wed, 12 Sep 2012 13:42:38 +0000 Subject: escape tags from loaded log files --- js/pkgsubmit.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/pkgsubmit.js b/js/pkgsubmit.js index bbd71ba..3bcfb46 100644 --- a/js/pkgsubmit.js +++ b/js/pkgsubmit.js @@ -125,6 +125,13 @@ function build_log_files_list(ev) { } } +/** + * See http://jsperf.com/encode-html-entities +*/ +function safe_tags_regex(str) { + return str.replace(/&/g, '&').replace(//g, '>'); +} + /** */ function show_log_file(ev) { @@ -157,7 +164,7 @@ function show_log_file(ev) { "/" + $(this).attr("href"), {}, function (data) { - $("#" + elId).html(highlight_text(data)) + $("#" + elId).html(highlight_text(safe_tags_regex(data))) .before( $("
", { class: "controls" -- cgit v1.2.1