From 88186e2306f6ac46c26243be728b5058c044f066 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 30 Jul 2018 09:41:04 +0200 Subject: [PATCH] Tweak the lookup --- app.py | 2 +- templates/utils.html | 2 +- utils/lookup.py | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index ba23e16..dce07d3 100644 --- a/app.py +++ b/app.py @@ -219,7 +219,7 @@ def _get_file_url(url, size, kind): return u # MEDIA_CACHE.cache(url, kind) - app.logger.error("cache not available for {url}/{size}/{kind}") + app.logger.error(f"cache not available for {url}/{size}/{kind}") return url diff --git a/templates/utils.html b/templates/utils.html index 78cd27d..8b15a1a 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -40,7 +40,7 @@ {% if not perma %} - + {% endif %} diff --git a/utils/lookup.py b/utils/lookup.py index 07627b6..3e97bfb 100644 --- a/utils/lookup.py +++ b/utils/lookup.py @@ -10,9 +10,10 @@ from little_boxes.webfinger import get_actor_url def lookup(url: str) -> ap.BaseActivity: """Try to find an AP object related to the given URL.""" try: - actor_url = get_actor_url(url) - if actor_url: - return ap.fetch_remote_activity(actor_url) + if url.startswith('@'): + actor_url = get_actor_url(url) + if actor_url: + return ap.fetch_remote_activity(actor_url) except NotAnActivityError: pass except requests.HTTPError: