Bug fixes
parent
8fbb48f671
commit
786072ec8a
|
@ -167,8 +167,8 @@ async def enforce_httpsig(
|
||||||
# Special case for Mastoodon instance that keep resending Delete
|
# Special case for Mastoodon instance that keep resending Delete
|
||||||
# activities for actor we don't know about if we raise a 401
|
# activities for actor we don't know about if we raise a 401
|
||||||
if httpsig_info.is_ap_actor_gone:
|
if httpsig_info.is_ap_actor_gone:
|
||||||
logger.info("Let's make Mastodon happy, returning a 204")
|
logger.info("Let's make Mastodon happy, returning a 202")
|
||||||
raise fastapi.HTTPException(status_code=204)
|
raise fastapi.HTTPException(status_code=202)
|
||||||
|
|
||||||
raise fastapi.HTTPException(status_code=401, detail="Invalid HTTP sig")
|
raise fastapi.HTTPException(status_code=401, detail="Invalid HTTP sig")
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,11 @@ def _scrap_og_meta(html: str) -> OpenGraphMeta | None:
|
||||||
def _urls_from_note(note: ap.RawObject) -> set[str]:
|
def _urls_from_note(note: ap.RawObject) -> set[str]:
|
||||||
note_host = urlparse(ap.get_id(note["id"]) or "").netloc
|
note_host = urlparse(ap.get_id(note["id"]) or "").netloc
|
||||||
|
|
||||||
|
tags_hrefs = set()
|
||||||
|
for tag in note.get("tag", []):
|
||||||
|
if tag_href := tag.get("href"):
|
||||||
|
tags_hrefs.add(tag_href)
|
||||||
|
|
||||||
urls = set()
|
urls = set()
|
||||||
if "content" in note:
|
if "content" in note:
|
||||||
soup = BeautifulSoup(note["content"], "html5lib")
|
soup = BeautifulSoup(note["content"], "html5lib")
|
||||||
|
@ -58,7 +63,7 @@ def _urls_from_note(note: ap.RawObject) -> set[str]:
|
||||||
):
|
):
|
||||||
urls.add(h)
|
urls.add(h)
|
||||||
|
|
||||||
return urls
|
return urls - tags_hrefs
|
||||||
|
|
||||||
|
|
||||||
async def _og_meta_from_url(url: str) -> OpenGraphMeta | None:
|
async def _og_meta_from_url(url: str) -> OpenGraphMeta | None:
|
||||||
|
|
Loading…
Reference in New Issue