about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-03-05 18:08:19 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-03-05 18:08:19 +0100
commit4fb95c91fbf808bafa581b8976d94ec36eee8619 (patch)
treeb371348da6ebfddb60c81794c0954d641f54a314 /app
parent5f4e402204c9da289d1a6b5e3902bf2c9cfe61c1 (diff)
Fix wrongful matching of last period in extended usernames
Fix anchor tags in some wikipedia URLs being matches as a hashtag
Diffstat (limited to 'app')
-rw-r--r--app/models/account.rb2
-rw-r--r--app/models/tag.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 2fa6bab71..078078945 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -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
diff --git a/app/models/tag.rb b/app/models/tag.rb
index 77a73cce8..0d2fe43b8 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -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