[Server] Escape HTML in webchat (#2368)

* escape HTML in webchat
* add amp
This commit is contained in:
Henri Vasserman 2023-07-25 10:27:34 +03:00 committed by GitHub
parent 41c674161f
commit c798308e3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 130 additions and 119 deletions

View file

@ -390,6 +390,9 @@
// poor mans markdown replacement
const Markdownish = (params) => {
const md = params.text
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/^#{1,6} (.*)$/gim, '<h3>$1</h3>')
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
.replace(/__(.*?)__/g, '<strong>$1</strong>')