# Bug with ' in tags

**URL:** https://meta.discourse.org/t/bug-with-in-tags/96111
**Category:** Bug
**Created:** [August 31, 2018, 7:11pm UTC](https://meta.discourse.org/t/bug-with-in-tags/96111 "2018-08-31T19:11:29Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![darix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darix/32/114280_2.png) [@darix](https://meta.discourse.org/u/darix)
#### Post date: [August 31, 2018, 7:11pm UTC](https://meta.discourse.org/t/bug-with-in-tags/96111/1 "2018-08-31T19:11:30Z")

</div>

as reported here [Tag goes to 404 - Meta - discuss.pixls.us](https://discuss.pixls.us/t/tag-goes-to-404/8849)

---

<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: [August 31, 2018, 9:47pm UTC](https://meta.discourse.org/t/bug-with-in-tags/96111/2 "2018-08-31T21:47:26Z")

</div>

I’m pretty sure `'` is not a valid tag character? As in it shouldn’t even be in there in the first place, as the UI doesn’t allow it?

---

<div class="post-metadata">

### Author: ![darix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darix/32/114280_2.png) [@darix](https://meta.discourse.org/u/darix)
#### Post date: [September 1, 2018, 11:01am UTC](https://meta.discourse.org/t/bug-with-in-tags/96111/3 "2018-09-01T11:01:24Z")

</div>

Oh I can happily create even tags like “bug’reporting’issue” in the UI.  
i can create it and originally it was even saved as that. but something  
or someone changed it afterwards. only visible after reloading the page.

I attached the g’mic tag also again to the thread but I guess it is  
stored in the DB now and therefor is not affected by the fix.

I still see 2 issues:

1. the user gets the impression that ’ in the tag should actually work  
as initially it lets you create one and renders it. but it seems the DB  
saves it without ’
2. old incorrect tags are not cleaned up. issue that I can see here is  
that trying to clean it up automatically might lead to duplicates.
3. how to easily delete such a tag and remove it from all posts?

---

<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 1, 2018, 12:32pm UTC](https://meta.discourse.org/t/bug-with-in-tags/96111/4 "2018-09-01T12:32:08Z")

</div>

What do you think @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 4, 2018, 4:24pm UTC](https://meta.discourse.org/t/bug-with-in-tags/96111/5 "2018-09-04T16:24:05Z")

</div>

I agree that the tag input should do a better job of showing what the tag name will be when you include characters that aren’t allowed.

To clean up the tags with apostrophes, you’ll need to do it from the rails console. Something like this:

```plaintext
tag = Tag.find_by_name("g'mic")
tag.name = "gmic"
tag.save!

```

---

<div class="post-metadata">

### Author: ![darix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darix/32/114280_2.png) [@darix](https://meta.discourse.org/u/darix)
#### Post date: [September 5, 2018, 2:17am UTC](https://meta.discourse.org/t/bug-with-in-tags/96111/6 "2018-09-05T02:17:20Z")

</div>

> I agree that the tag input should do a better job of showing what the  
> tag name will be when you include characters that aren’t allowed.

Looking forward to this fix for the UI.

> To clean up the tags with apostrophes, you’ll need to do it from the  
> rails console. Something like this:
> 
> ```plaintext
> tag = Tag.find_by_name("g'mic")
> tag.name = "gmic"
> tag.save!
> 
> ```

As we had a tag:gmic already i just did

```plaintext
tag_bad = Tag.find_by_name("g'mic")
tag_good = Tag.find_by_name("gmic")

tag_good.topic_ids += tag_bad.topic_ids
tag_good.save
tag_bad.delete

```

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [September 13, 2018, 10:21pm UTC](https://meta.discourse.org/t/bug-with-in-tags/96111/8 "2018-09-13T22:21:20Z")

</div>

Fixed by

[https://github.com/discourse/discourse/pull/6400](https://github.com/discourse/discourse/pull/6400)

---

<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 16, 2018, 1:00am UTC](https://meta.discourse.org/t/bug-with-in-tags/96111/9 "2018-09-16T01:00:04Z")

</div>

This topic was automatically closed after 2 days. New replies are no longer allowed.
