mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(table): uses lodash to escape html
This commit is contained in:
@@ -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];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user