mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-21 00:39:16 +00:00
Fix User.get_or_fetch/1 with usernames starting with http
This commit is contained in:
parent
dbe678cb06
commit
2aa8e66527
|
@ -1988,7 +1988,8 @@ defmodule Pleroma.User do
|
|||
|
||||
@doc "Gets or fetch a user by uri or nickname."
|
||||
@spec get_or_fetch(String.t()) :: {:ok, User.t()} | {:error, String.t()}
|
||||
def get_or_fetch("http" <> _host = uri), do: get_or_fetch_by_ap_id(uri)
|
||||
def get_or_fetch("http://" <> _host = uri), do: get_or_fetch_by_ap_id(uri)
|
||||
def get_or_fetch("https://" <> _host = uri), do: get_or_fetch_by_ap_id(uri)
|
||||
def get_or_fetch(nickname), do: get_or_fetch_by_nickname(nickname)
|
||||
|
||||
# wait a period of time and return newest version of the User structs
|
||||
|
|
|
@ -737,6 +737,13 @@ defmodule Pleroma.UserTest do
|
|||
freshed_user = refresh_record(user)
|
||||
assert freshed_user == fetched_user
|
||||
end
|
||||
|
||||
test "gets an existing user by nickname starting with http" do
|
||||
user = insert(:user, nickname: "httpssome")
|
||||
{:ok, fetched_user} = User.get_or_fetch("httpssome")
|
||||
|
||||
assert user == fetched_user
|
||||
end
|
||||
end
|
||||
|
||||
describe "get_or_fetch/1 remote users with tld, while BE is runned on subdomain" do
|
||||
|
|
Loading…
Reference in a new issue