Bug with ' in tags


(Darix) #1

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


(Jeff Atwood) #2

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?


(Darix) #3

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?

(Jeff Atwood) #4

What do you think @neil?


(Neil Lalonde) #5

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!

(Darix) #6

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

(Bianca) #8

Fixed by


(Jeff Atwood) #9

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