From e4137736f6aa32011f88ce46e90a7b039e5b8053 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Mon, 23 Mar 2026 15:18:54 +0800 Subject: [PATCH] fix(qq): handle file:// URI on Windows in _read_media_bytes urlparse on Windows puts the path in netloc, not path. Use (parsed.path or parsed.netloc) to get the correct raw path. --- nanobot/channels/qq.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nanobot/channels/qq.py b/nanobot/channels/qq.py index 7442e10..b9d2d64 100644 --- a/nanobot/channels/qq.py +++ b/nanobot/channels/qq.py @@ -373,7 +373,9 @@ class QQChannel(BaseChannel): try: if media_ref.startswith("file://"): parsed = urlparse(media_ref) - local_path = Path(unquote(parsed.path)) + # Windows: path in netloc; Unix: path in path + raw = parsed.path or parsed.netloc + local_path = Path(unquote(raw)) else: local_path = Path(os.path.expanduser(media_ref))