summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2023-10-03 11:01:45 -0400
committerClaire <claire.github-309c@sitedethib.com>2023-10-10 13:51:14 +0200
commit905baaaff21888723a2dcd74d167762a41ea2e42 (patch)
treefbde9cbca6734694b057d1f0d514b93cd262f361
parent26f24f4de0985643cc862b7d1af24db76dd909ff (diff)
Dont match mention in url query string (#25656)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
-rw-r--r--app/models/account.rb6
-rw-r--r--spec/models/account_spec.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 3cd86b59568..cdf1c48b1e9 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -61,9 +61,9 @@ class Account < ApplicationRecord
trust_level
)
- USERNAME_RE = /[a-z0-9_]+([a-z0-9_\.-]+[a-z0-9_]+)?/i
- MENTION_RE = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]\.\-]+[[:word:]]+)?)/i
- URL_PREFIX_RE = /\Ahttp(s?):\/\/[^\/]+/
+ USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i
+ MENTION_RE = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@[[:word:].-]+[[:word:]]+)?)}i
+ URL_PREFIX_RE = %r{\Ahttp(s?)://[^/]+}
USERNAME_ONLY_RE = /\A#{USERNAME_RE}\z/i
include Attachmentable
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index edae05f9db6..a40dfae96f3 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -689,7 +689,7 @@ RSpec.describe Account, type: :model do
expect(subject.match('Check this out https://medium.com/@alice/some-article#.abcdef123')).to be_nil
end
- xit 'does not match URL querystring' do
+ it 'does not match URL query string' do
expect(subject.match('https://example.com/?x=@alice')).to be_nil
end
end