Bug with ' in tags

as reported here Tag goes to 404 - Meta - discuss.pixls.us

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?

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?
4 Likes

What do you think @neil?

3 Likes

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:

tag = Tag.find_by_name("g'mic")
tag.name = "gmic"
tag.save!
3 Likes

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:

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

As we had a tag:gmic already i just did

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
3 Likes

Fixed by

https://github.com/discourse/discourse/pull/6400

5 Likes

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