tag.rb: don't strip '%' or ',' from tags; split on unicode spaces.

Allows '%' and ',' in tag names. There's no technical need to forbid
these characters.

Fixes an issue with these characters being stripped away inside metatags
(e.g. tagging a post with `pool:ichigo_100%` strips away the '%').
This commit is contained in:
evazion
2017-02-08 22:53:37 -06:00
parent 853ddc7cda
commit 8e3296f3ea

View File

@@ -229,13 +229,13 @@ class Tag < ActiveRecord::Base
def scan_query(query)
tagstr = normalize(query)
list = tagstr.scan(/-?source:".*?"/) || []
list + tagstr.gsub(/-?source:".*?"/, "").scan(/\S+/).uniq
list + tagstr.gsub(/-?source:".*?"/, "").scan(/[^[:space:]]+/).uniq
end
def scan_tags(tags, options = {})
tagstr = normalize(tags)
list = tagstr.scan(/source:".*?"/) || []
list += tagstr.gsub(/source:".*?"/, "").gsub(/[%,]/, "").scan(/\S+/).uniq
list += tagstr.gsub(/source:".*?"/, "").scan(/[^[:space:]]+/).uniq
if options[:strip_metatags]
list = list.map {|x| x.sub(/^[-~]/, "")}
end