From 7c6768266cf0fd6e4ace5555ccc8f543b267b908 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 21 Aug 2022 09:52:48 +0200 Subject: [PATCH] Improve lookup --- app/lookup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/lookup.py b/app/lookup.py index 84af030..7e15404 100644 --- a/app/lookup.py +++ b/app/lookup.py @@ -6,10 +6,11 @@ from app.actor import Actor from app.actor import RemoteActor from app.ap_object import RemoteObject from app.database import AsyncSession +from app.source import _MENTION_REGEX 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 if not query: