No point in trying to retrieve remote diaspora content if no handle

merge-requests/131/head
Jason Robinson 2018-09-22 13:39:13 +03:00
rodzic 979b43636d
commit cf790f8b92
2 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -3,7 +3,6 @@ import logging
from typing import Optional, Callable
from federation.entities.base import Profile
from federation.utils.diaspora import parse_profile_diaspora_id
logger = logging.getLogger("federation")

Wyświetl plik

@ -9,6 +9,7 @@ from xrd import XRD
from federation.inbound import handle_receive
from federation.utils.network import fetch_document
from federation.utils.text import validate_handle
logger = logging.getLogger("federation")
@ -217,6 +218,8 @@ def retrieve_and_parse_content(
to fetch the profile and the key. Function must take handle as only parameter and return a public key.
:returns: Entity object instance or ``None``
"""
if not validate_handle(handle):
return
_username, domain = handle.split("@")
url = get_fetch_content_endpoint(domain, entity_type, guid)
document, status_code, error = fetch_document(url)