Use end-of-string in regex for local get_by_nickname
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
parent
d1d7dd1827
commit
cb7086cb18
2 changed files with 2 additions and 1 deletions
1
changelog.d/local-nickname-regex.fix
Normal file
1
changelog.d/local-nickname-regex.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Use end-of-string in regex for local `get_by_nickname`
|
||||
|
|
@ -1364,7 +1364,7 @@ defmodule Pleroma.User do
|
|||
@spec get_by_nickname(String.t()) :: User.t() | nil
|
||||
def get_by_nickname(nickname) do
|
||||
Repo.get_by(User, nickname: nickname) ||
|
||||
if Regex.match?(~r(@#{Pleroma.Web.Endpoint.host()})i, nickname) do
|
||||
if Regex.match?(~r(@#{Pleroma.Web.Endpoint.host()}$)i, nickname) do
|
||||
Repo.get_by(User, nickname: local_nickname(nickname))
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue