Add parser.path to html sanitiser, fixing tests

This commit is contained in:
Joe Knapper 2026-03-11 10:24:40 +00:00
parent fd0c0bd277
commit 2e1066477e

View file

@ -29,7 +29,7 @@ def sanitize_http_url(url: str) -> Optional[str]:
if not parsed.netloc:
return None
fragment_str = "#" + parsed.fragment if parsed.fragment else ""
return f"{parsed.scheme}://{parsed.netloc}{fragment_str}"
return f"{parsed.scheme}://{parsed.netloc}{parsed.path}{fragment_str}"
class SafeHTMLParser(HTMLParser):