From 00249dd2a9eb5563a82d0291b933242331f99d16 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 26 Feb 2026 13:35:06 +0000 Subject: [PATCH] Fix nh3 panic: use link_rel param instead of rel in attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nh3 manages the rel attribute internally — setting it in tag_attributes triggers an assertion. Use link_rel parameter instead. Co-Authored-By: Claude Opus 4.6 --- blog/bp/blog/ghost/ghost_sync.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blog/bp/blog/ghost/ghost_sync.py b/blog/bp/blog/ghost/ghost_sync.py index dd803bb..19faee6 100644 --- a/blog/bp/blog/ghost/ghost_sync.py +++ b/blog/bp/blog/ghost/ghost_sync.py @@ -46,7 +46,7 @@ def _sanitize_html(html: str | None) -> str | None: }, attributes={ "*": {"class", "id", "style"}, - "a": {"href", "title", "target", "rel"}, + "a": {"href", "title", "target"}, "img": {"src", "alt", "title", "width", "height", "loading"}, "video": {"src", "controls", "width", "height", "poster"}, "audio": {"src", "controls"}, @@ -55,6 +55,7 @@ def _sanitize_html(html: str | None) -> str | None: "td": {"colspan", "rowspan"}, "th": {"colspan", "rowspan"}, }, + link_rel="noopener noreferrer", url_schemes={"http", "https", "mailto"}, )