Skip to content

Commit

Permalink
chore: improve custom sanitizer regex
Browse files Browse the repository at this point in the history
- the previous implementation was a little too agressive on the words that had `on...`, for example this sentence `<a href="online.cgi?query=dynamicData">Link Text</a>` was being replaced to `<a href="dynamicData">Link Text</a>` but it shouldn't. The new PR adresses this and makes a little less agressive
  • Loading branch information
ghiscoding committed Jan 20, 2023
1 parent 747c690 commit 48d94e8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const SalesforceGlobalGridOptions = {
iconSortAscCommand: 'fa fa-sort-amount-asc mdi mdi-arrow-up',
iconSortDescCommand: 'fa fa-sort-amount-desc mdi mdi-arrow-down',
},
sanitizer: (dirtyHtml: string) => typeof dirtyHtml === 'string' ? dirtyHtml.replace(/(\b)(on\S+)(\s*)=|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(&lt;)(\/*)(script|script defer)(.*)(&gt;|&gt;">)/gi, '') : dirtyHtml,
sanitizer: (dirtyHtml: string) => typeof dirtyHtml === 'string' ? dirtyHtml.replace(/(\b)(on[a-z]+)(\s*)=|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(&lt;)(\/*)(script|script defer)(.*)(&gt;|&gt;">)/gi, '') : dirtyHtml,
showCustomFooter: true,
customFooterOptions: {
hideMetrics: false,
Expand Down

0 comments on commit 48d94e8

Please sign in to comment.