]> cat aescling's git repositories - mastodon.git/commitdiff
Fix MENTION_RE to not match nil usernames (#6862)
authorThibG <thib@sitedethib.com>
Thu, 22 Mar 2018 09:45:48 +0000 (10:45 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 22 Mar 2018 09:45:48 +0000 (10:45 +0100)
app/models/account.rb

index 14269860f02e92daf6fc39029889b17d1de149ec..c88c6ec4404ead3e4ebf1c0d3188c085a137deee 100644 (file)
@@ -48,7 +48,7 @@
 
 class Account < ApplicationRecord
   USERNAME_RE = /[a-z0-9_]+([a-z0-9_\.]+[a-z0-9_]+)?/i
-  MENTION_RE  = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE}?)(?:@[a-z0-9\.\-]+[a-z0-9]+)?)/i
+  MENTION_RE  = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[a-z0-9\.\-]+[a-z0-9]+)?)/i
 
   include AccountAvatar
   include AccountFinderConcern