diff options
author | André Peters <andryyy@users.noreply.github.com> | 2017-07-08 22:56:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-08 22:56:21 +0200 |
commit | b19560aa3fed3084fc7d37e91cd86c0fa0d96917 (patch) | |
tree | 437429bcb299a27c8fcc23f99eab0caeb3444e53 /interface/js | |
parent | 08c88c0e020987316a9acf761827ab268237e041 (diff) | |
download | rspamd-b19560aa3fed3084fc7d37e91cd86c0fa0d96917.tar.gz rspamd-b19560aa3fed3084fc7d37e91cd86c0fa0d96917.zip |
Escape HTML in cells by using underscores escaper
Diffstat (limited to 'interface/js')
-rw-r--r-- | interface/js/app/history.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/interface/js/app/history.js b/interface/js/app/history.js index 3e8010de4..02c393011 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -26,7 +26,22 @@ define(['jquery', 'footable', 'humanize'], function($, _, Humanize) { var interface = {}; var ft = {}; - + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/' + }; + var htmlEscaper = /[&<>"'\/]/g; + + EscapeHTML = function(string) { + return ('' + string).replace(htmlEscaper, function(match) { + return htmlEscapes[match]; + }); + }; + function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString(); @@ -178,7 +193,8 @@ function($, _, Humanize) { "font-size": "11px", "word-break": "break-all", "minWidth": 150 - } + }, + "formatter": EscapeHTML }, { "name": "action", "title": "Action", |