Improve lookup
parent
6b670c74cf
commit
7c6768266c
|
@ -6,10 +6,11 @@ from app.actor import Actor
|
||||||
from app.actor import RemoteActor
|
from app.actor import RemoteActor
|
||||||
from app.ap_object import RemoteObject
|
from app.ap_object import RemoteObject
|
||||||
from app.database import AsyncSession
|
from app.database import AsyncSession
|
||||||
|
from app.source import _MENTION_REGEX
|
||||||
|
|
||||||
|
|
||||||
async def lookup(db_session: AsyncSession, query: str) -> Actor | RemoteObject:
|
async def lookup(db_session: AsyncSession, query: str) -> Actor | RemoteObject:
|
||||||
if query.startswith("@"):
|
if query.startswith("@") or _MENTION_REGEX.match("@" + query):
|
||||||
query = await webfinger.get_actor_url(query) # type: ignore # None check below
|
query = await webfinger.get_actor_url(query) # type: ignore # None check below
|
||||||
|
|
||||||
if not query:
|
if not query:
|
||||||
|
|
Loading…
Reference in New Issue