From 2dfc0ddf8104b7374846add8b5e9a6ac0acb913b Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 14 Oct 2016 15:29:47 -0400 Subject: [PATCH] loosen restrictions on chars in tags --- lib/discourse_tagging.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/discourse_tagging.rb b/lib/discourse_tagging.rb index 42753628a9b..d3e651eb83b 100644 --- a/lib/discourse_tagging.rb +++ b/lib/discourse_tagging.rb @@ -1,9 +1,7 @@ -require_dependency 'slug' - module DiscourseTagging TAGS_FIELD_NAME = "tags" - TAGS_FILTER_REGEXP = Slug::CHAR_FILTER_REGEXP + TAGS_FILTER_REGEXP = /[\/\?#\[\]@!\$&'\(\)\*\+,;=\.%\\`^\s|\{\}"<>]+/ # /?#[]@!$&'()*+,;=.%\`^|{}"<> def self.tag_topic_by_names(topic, guardian, tag_names_arg) @@ -143,7 +141,9 @@ module DiscourseTagging end def self.clean_tag(tag) - Slug.sanitize(tag.downcase.strip)[0...SiteSetting.max_tag_length] + tag.downcase.strip + .gsub(/\s+/, '-').squeeze('-') + .gsub(TAGS_FILTER_REGEXP, '')[0...SiteSetting.max_tag_length] end def self.staff_only_tags(tags)