Skip to content

Commit

Permalink
MAT-7204 add event trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
ethankaplan committed Jun 17, 2024
1 parent c94f207 commit 7906e26
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/util/wafIntercept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ const wafIntercept = () =>
? error.response.data.split("ID:")[1].split("<br>")[0].trim()
: "";
const body = error.response.data.split("<body>")[1].split("<br>")[0];
throw new Error(DOMPurify.sanitize(body, { ALLOWED_TAGS: [] })); // no tags allowed, removes all HTML tags.
const purifiedBody = DOMPurify.sanitize(body, { ALLOWED_TAGS: [] });

const wafEvent = new CustomEvent("wafReject", {
detail: { message: purifiedBody },
});
document.dispatchEvent(wafEvent);
throw new Error(purifiedBody); // no tags allowed, removes all HTML tags.
}

return Promise.reject(error);
}
);
Expand Down

0 comments on commit 7906e26

Please sign in to comment.