# Category description can create invalid html in summary emails

**URL:** https://meta.discourse.org/t/category-description-can-create-invalid-html-in-summary-emails/68034
**Category:** Bug
**Created:** [2017 年 8 月 14 日午後 5:30 UTC](https://meta.discourse.org/t/category-description-can-create-invalid-html-in-summary-emails/68034 "2017-08-14T17:30:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dans](https://avatars.discourse-cdn.com/v4/letter/d/7993a0/32.png) [@dans](https://meta.discourse.org/u/dans)
#### Post date: [2017 年 8 月 14 日午後 5:30 UTC](https://meta.discourse.org/t/category-description-can-create-invalid-html-in-summary-emails/68034/1 "2017-08-14T17:30:52Z")

</div>

Using a text pattern like `some text ' > some more text` in a category description generates invalid html in “Since your last visit” summary emails. It closes the HTML title tag and the text that is supposed to be displayed in the title tag is rendered as text in the email.  
To not use `.html_safe` in lib/category\_badge line 77 seems to fix it. This works:  
`description = category.description_text ? "title='#{category.description_text}'" : ''`

> <https://github.com/discourse/discourse/blob/94d8f6d7342e862a38b9d01d7d9bac556dd038b2/lib/category_badge.rb#L77>

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [2017 年 8 月 14 日午後 9:28 UTC](https://meta.discourse.org/t/category-description-can-create-invalid-html-in-summary-emails/68034/2 "2017-08-14T21:28:28Z")

</div>

Removing that might break it somewhere else. I’ll have a look.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [2017 年 8 月 15 日午後 10:27 UTC](https://meta.discourse.org/t/category-description-can-create-invalid-html-in-summary-emails/68034/4 "2017-08-15T22:27:44Z")

</div>

Looks like this is fixed. I could reproduce it on an old version, but can’t now.

 ![39 PM](https://global.discourse-cdn.com/meta/original/3X/b/b/bba7878f25f8d29f651d0bbcf589586ea3dc323d.png)

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [2017 年 8 月 17 日午後 9:31 UTC](https://meta.discourse.org/t/category-description-can-create-invalid-html-in-summary-emails/68034/5 "2017-08-17T21:31:18Z")

</div>


