From 909f97368cac0e30122fa7da3b95303e8f5717e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 19 Jun 2026 11:03:49 +0000 Subject: [PATCH] fix: don't crash on invalid URLs in HTML (#755) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Timothée Mazzucotelli --- python/zensical/extensions/links.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/zensical/extensions/links.py b/python/zensical/extensions/links.py index 63072cc..0c43dcc 100644 --- a/python/zensical/extensions/links.py +++ b/python/zensical/extensions/links.py @@ -191,7 +191,10 @@ def _is_relative(value: str) -> bool: return False # Absolute URLs (e.g. `https://example.com`) and protocol-relative URLs - url = urlparse(value) + try: + url = urlparse(value) + except ValueError: + return False if url.scheme or url.netloc or url.path.startswith("/"): return False