Skip to content

Commit

Permalink
Fixed XSS vulnerability bug by onCellHtmlData
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzhixin committed May 10, 2022
1 parent 55d3760 commit b4a1e5d
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/extensions/export/bootstrap-table-export.js
Expand Up @@ -23,15 +23,7 @@ $.extend($.fn.bootstrapTable.defaults, {
showExport: false,
exportDataType: 'basic', // basic, all, selected
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
exportOptions: {
onCellHtmlData (cell, rowIndex, colIndex, htmlData) {
if (cell.is('th')) {
return cell.find('.th-inner').text()
}

return htmlData
}
},
exportOptions: {},
exportFooter: false
})

Expand Down Expand Up @@ -162,13 +154,9 @@ $.BootstrapTable = class extends $.BootstrapTable {
$exportButtons.click(e => {
e.preventDefault()

const type = $(e.currentTarget).data('type')
const exportOptions = {
type,
escape: false
}

this.exportTable(exportOptions)
this.exportTable({
type: $(e.currentTarget).data('type')
})
})
this.handleToolbar()
}
Expand Down

0 comments on commit b4a1e5d

Please sign in to comment.