main
Thomas Sileo 2022-09-13 21:02:47 +02:00
parent bd4d5a004a
commit 91b8bb26b7
2 changed files with 4 additions and 1 deletions

View File

@ -26,7 +26,7 @@ async def new_ap_incoming_activity(
raw_object: ap.RawObject,
) -> models.IncomingActivity | None:
ap_id: str
if "id" not in raw_object:
if "id" not in raw_object or ap.as_list(raw_object["type"])[0] in ap.ACTOR_TYPES:
if "@context" not in raw_object:
logger.warning(f"Dropping invalid object: {raw_object}")
return None

View File

@ -81,6 +81,9 @@ async def external_urls(
soup = BeautifulSoup(ro.content, "html5lib")
for link in soup.find_all("a"):
h = link.get("href")
if not h:
continue
ph = urlparse(h)
mimetype, _ = mimetypes.guess_type(h)
if (