0
0
Fork 0

Fix wrongful matching of last period in extended usernames

Fix anchor tags in some wikipedia URLs being matches as a hashtag
This commit is contained in:
Eugen Rochko 2017-03-05 18:08:19 +01:00
parent 5f4e402204
commit 4fb95c91fb
4 changed files with 20 additions and 3 deletions

View file

@ -4,7 +4,7 @@ class Account < ApplicationRecord
include Targetable
include PgSearch
MENTION_RE = /(?:^|[^\/\w])@([a-z0-9_]+(?:@[a-z0-9\.\-]+)?)/i
MENTION_RE = /(?:^|[^\/\w])@([a-z0-9_]+(?:@[a-z0-9\.\-]+[a-z0-9]+)?)/i
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze
# Local users

View file

@ -3,7 +3,7 @@
class Tag < ApplicationRecord
has_and_belongs_to_many :statuses
HASHTAG_RE = /(?:^|[^\/\w])#([[:word:]_]*[[:alpha:]_][[:word:]_]*)/i
HASHTAG_RE = /(?:^|[^\/\)\w])#([[:word:]_]*[[:alpha:]_][[:word:]_]*)/i
validates :name, presence: true, uniqueness: true