From: ThibG Date: Thu, 22 Mar 2018 09:45:48 +0000 (+0100) Subject: Fix MENTION_RE to not match nil usernames (#6862) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=6f531d140b8398a4680567934fe66cb0ca465fbc;p=mastodon.git Fix MENTION_RE to not match nil usernames (#6862) --- diff --git a/app/models/account.rb b/app/models/account.rb index 14269860f..c88c6ec44 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -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