Skip to content

Commit

Permalink
alert view: fix rule highlighting when html is in rule.
Browse files Browse the repository at this point in the history
Reported by Victor Julien.
  • Loading branch information
jasonish committed Nov 29, 2024
1 parent 057edc3 commit e7e741a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions webapp/src/EventView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,9 @@ function HighlightedRule(props: { rule: string }) {
createEffect(() => {
let html = props.rule;

html = html.replace("<", "%___lt___%");
html = html.replace(">", "%___gt___%");

html = html.replace(
/^([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+/,
`<span class="rule-header-action">$1</span>
Expand All @@ -1252,8 +1255,8 @@ function HighlightedRule(props: { rule: string }) {
// Replace referece URLs with the URL.
html = html.replace(/url,(.*?)([;<])/g, `url,<a href="http://$1">$1</a>$2`);

html = html.replace("&___lt___", "&lt;");
html = html.replace("&___gt___", "&gt;");
html = html.replace("%___lt___%", "&lt;");
html = html.replace("%___gt___%", "&gt;");

setRule(html);
});
Expand Down

0 comments on commit e7e741a

Please sign in to comment.