mirror of https://github.com/mastodon/mastodon
Use TwitterText regex for valid domains in mentions
TwitterText already has a regex to check for valid domains that allows a few domains the current Regex did not allow. Mainly it allows mentions of accounts on domains with emoji in their domain names to be processed correctly. Mentions like `@test@🌈🌈🌈.st` will now work correctly.
This commit is contained in:
parent
61a0ec69fc
commit
51f47c54bf
|
@ -66,7 +66,7 @@ class Account < ApplicationRecord
|
|||
BACKGROUND_REFRESH_INTERVAL = 1.week.freeze
|
||||
|
||||
USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i
|
||||
MENTION_RE = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@[[:word:].-]+[[:word:]]+)?)}i
|
||||
MENTION_RE = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@#{Twitter::TwitterText::Regex[:valid_domain]})?)}i
|
||||
URL_PREFIX_RE = %r{\Ahttp(s?)://[^/]+}
|
||||
USERNAME_ONLY_RE = /\A#{USERNAME_RE}\z/i
|
||||
|
||||
|
|
Loading…
Reference in New Issue