From 8e3296f3ea94f9afa65498a96e918498fa34a347 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 8 Feb 2017 22:53:37 -0600 Subject: [PATCH] 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 '%'). --- app/models/tag.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 301b89f1b..bb2e5dc93 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -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