summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-09-12 13:42:38 +0000
committerRomain d'Alverny <rda@mageia.org>2012-09-12 13:42:38 +0000
commit5184c67ffb4863cc36687ea0307a43a611ca3c3f (patch)
tree149d3e2ebae00fc14f52e7ad49e3d276db4dd0e7
parent29f3d38949eae57f8ffd0dd41ae737ac572c57bc (diff)
downloadpkgsubmit-5184c67ffb4863cc36687ea0307a43a611ca3c3f.tar
pkgsubmit-5184c67ffb4863cc36687ea0307a43a611ca3c3f.tar.gz
pkgsubmit-5184c67ffb4863cc36687ea0307a43a611ca3c3f.tar.bz2
pkgsubmit-5184c67ffb4863cc36687ea0307a43a611ca3c3f.tar.xz
pkgsubmit-5184c67ffb4863cc36687ea0307a43a611ca3c3f.zip
escape tags from loaded log files
-rw-r--r--js/pkgsubmit.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/js/pkgsubmit.js b/js/pkgsubmit.js
index bbd71ba..3bcfb46 100644
--- a/js/pkgsubmit.js
+++ b/js/pkgsubmit.js
@@ -126,6 +126,13 @@ function build_log_files_list(ev) {
}
/**
+ * See http://jsperf.com/encode-html-entities
+*/
+function safe_tags_regex(str) {
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+}
+
+/**
*/
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(
$("<div />", {
class: "controls"