From e7ff018487bb556f619990f414f5826645f57042 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 9 Feb 2016 11:05:11 +0100 Subject: [PATCH] feat(table): uses lodash to escape html --- public/app/plugins/panel/table/renderer.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/public/app/plugins/panel/table/renderer.ts b/public/app/plugins/panel/table/renderer.ts index 68cb594ab5e..0a306b103a4 100644 --- a/public/app/plugins/panel/table/renderer.ts +++ b/public/app/plugins/panel/table/renderer.ts @@ -96,7 +96,7 @@ export class TableRenderer { renderCell(columnIndex, value, addWidthHack = false) { value = this.formatColumnValue(columnIndex, value); - value = this.encodeHtml(value); + value = _.escape(value); var style = ''; if (this.colorState.cell) { style = ' style="background-color:' + this.colorState.cell + ';color: white"'; @@ -141,17 +141,4 @@ export class TableRenderer { return html; } - - encodeHtml(unsafe) { - return unsafe.replace(/[&<>"']/g, function(m) { - return ({ - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '/': '/' - })[m]; - }); - } }