# Tag name with single quote causes server error

**URL:** <https://meta.discourse.org/t/tag-name-with-single-quote-causes-server-error/35994>\
**Category:** Bug\
**Created:** [November 24, 2015, 6:29pm UTC](https://meta.discourse.org/t/tag-name-with-single-quote-causes-server-error/35994 "2015-11-24T18:29:53Z")\
**Posts on this page:** 6\
**Page:** 1

## AI-generated summary

A user reported a bug in the [discourse-tagging](https://github.com/discourse/discourse-tagging) plugin (v0.2) where creating a tag with a single quote (e.g., "drag'n") triggers a "500 Internal Server Error". The reporter noted it is low priority but suggested a more helpful error message. [codinghorror](/t/-/35994/2) suggested that tags with quotes should not be allowed, while [neil](/t/-/35994/4) confirmed that the current filter is insufficient, allowing single quotes and other invalid characters like `"=!`. [neil](/t/-/35994/5) subsequently fixed the issue by implementing stricter character stripping for new tags, aligning them with topic and category slug rules, while leaving existing tags unaffected.

<div class="post-metadata">

**Author:** ![hinerm](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hinerm](https://meta.discourse.org/u/hinerm)\
**Post date:** [November 24, 2015, 6:29pm UTC](https://meta.discourse.org/t/tag-name-with-single-quote-causes-server-error/35994/1 "2015-11-24T18:29:53Z")

</div>

Using the [discourse-tagging](https://github.com/discourse/discourse-tagging) plugin version 0.2, if someone tries to create a tag that has a single quote ( ’ ) in the name (eg, “drag’n”) they get a “500 Internal Server Error”.

Not a high priority as it’s easy to work around, but a more helpful error message would be great.

Thanks!

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [November 24, 2015, 6:39pm UTC](https://meta.discourse.org/t/tag-name-with-single-quote-causes-server-error/35994/2 "2015-11-24T18:39:09Z")

</div>

I don’t think we should allow tags with quotes in them @neil.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [September 22, 2016, 11:01pm UTC](https://meta.discourse.org/t/tag-name-with-single-quote-causes-server-error/35994/3 "2016-09-22T23:01:06Z")

</div>

Do we check for oddball / problem chars in tags now @neil?

---

<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:** [September 23, 2016, 4:00pm UTC](https://meta.discourse.org/t/tag-name-with-single-quote-causes-server-error/35994/4 "2016-09-23T16:00:32Z")

</div>

Hmm, we do filter out some but are still allowing single quotes. Also other characters that shouldn’t be allowed like `"=!` and probably more. I’m not sure why the tag plugin ever had its own filter TAGS\_FILTER\_REGEXP for this.

---

<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:** [October 12, 2016, 8:19pm UTC](https://meta.discourse.org/t/tag-name-with-single-quote-causes-server-error/35994/5 "2016-10-12T20:19:40Z")

</div>

I fixed this today. New tags will have more characters stripped from them, more in line with rules for topic and category slugs. Existing tags with weird characters that happen to work won’t be affected.

---

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [August 3, 2020, 3:34pm UTC](https://meta.discourse.org/t/tag-name-with-single-quote-causes-server-error/35994/6 "2020-08-03T15:34:44Z")

</div>

Closed on August 3, 2020, 3:34pm UTC


