Browse Source

Allow alt and title tags in chat emojis (#1241)

* allow alt and title on chat imgs

* enforce non-empty alt&title tags for emojis
pull/1244/head
Meisam 4 years ago committed by GitHub
parent
commit
c4c1ecfc7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      core/chat/events/events.go

3
core/chat/events/events.go

@ -139,7 +139,8 @@ func sanitize(raw string) string { @@ -139,7 +139,8 @@ func sanitize(raw string) string {
p.AllowElements("br", "p")
// Allow img tags from the the local emoji directory only
p.AllowAttrs("src", "alt", "class", "title").Matching(regexp.MustCompile(`(?i)/img/emoji`)).OnElements("img")
p.AllowAttrs("src").Matching(regexp.MustCompile(`(?i)/img/emoji`)).OnElements("img")
p.AllowAttrs("alt", "title").Matching(regexp.MustCompile(`:\S+:`)).OnElements("img")
p.AllowAttrs("class").OnElements("img")
// Allow bold

Loading…
Cancel
Save