mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2026-02-15 17:16:57 +00:00
Merge branch 'local-nickname-regex-fix' into 'develop'
Use end-of-string in regex for local `get_by_nickname` See merge request pleroma/pleroma!4358
This commit is contained in:
commit
b6e16877e6
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`
|
||||||
|
|
@ -1357,7 +1357,7 @@ defmodule Pleroma.User do
|
||||||
@spec get_by_nickname(String.t()) :: User.t() | nil
|
@spec get_by_nickname(String.t()) :: User.t() | nil
|
||||||
def get_by_nickname(nickname) do
|
def get_by_nickname(nickname) do
|
||||||
Repo.get_by(User, nickname: nickname) ||
|
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))
|
Repo.get_by(User, nickname: local_nickname(nickname))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue