From 645bac53bbf26e7613fd4f242b028b72c8075b16 Mon Sep 17 00:00:00 2001 From: Zhang Yanpo Date: Sun, 22 Feb 2026 19:09:10 +0800 Subject: [PATCH 1/2] fix: use `pathlib.Path.as_uri()` for `` in `render_to_img()` Replace raw `"file://"` string concatenation with `pathlib.Path.as_uri()` for the `` tag, fixing cross-platform issues (backslashes on Windows, missing third slash, unescaped spaces). Co-Authored-By: Claude Opus 4.6 --- down2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/down2.py b/down2.py index 2685a14..667b5c3 100755 --- a/down2.py +++ b/down2.py @@ -371,7 +371,8 @@ def render_to_img( input = r'' + input if asset_base is not None: - input = ''.format(html_escape(asset_base)) + input + base_uri = pathlib.Path(asset_base).as_uri() + input = ''.format(base_uri) + input m = mimetypes.get(mime) or mime From cfb1e84150c5b827b9754fecc07e2c9f9d1143e2 Mon Sep 17 00:00:00 2001 From: Zhang Yanpo Date: Sun, 22 Feb 2026 19:13:03 +0800 Subject: [PATCH 2/2] fix: remove unused html_escape import Co-Authored-By: Claude Opus 4.6 --- down2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/down2.py b/down2.py index 667b5c3..714618d 100755 --- a/down2.py +++ b/down2.py @@ -14,7 +14,6 @@ import urllib.error import urllib.parse import urllib.request -from html import escape as html_escape from PIL import Image, ImageChops from playwright.sync_api import Browser, sync_playwright