Repository navigation
fix(ui): 内联图片/媒体与链接点击的 minis:// 解析统一 - #6
Merged
Merged
Conversation
[T-minis-decode-unify] Field report: old messages' inline images rendered broken while tapping the same URL worked, recovering after an app restart or re-entering the session. The report's theory (a cleared 'preview cache' breaking minis:// resolution) does not exist in code — three real defects did: 1. URLDecoder everywhere in the media path. It implements application/x-www-form-urlencoded, where '+' means SPACE — a real filename character — so 'foo+bar.png' never resolved. ChatLinkResolver had already replaced it for link TAPS with a hand-rolled %XX decode plus a second, double-decode candidate (T-android-minis-url-double- encoding); the media path never got that fix, so a double-encoded URL broke the image while the tap on the same URL worked. 2. MarkdownText (sub-agent bar, skills screen) resolved minis:// against the GLOBAL bindMounts map — last-writer-wins across sessions — so an old message's image pointed at whichever session booted its shell last, and re-entering the chat re-pointed it (the 'restart fixes it' symptom). Its image/video/audio blocks now share the session-aware resolveMdMediaFile with the streaming renderer via LocalMarkdownSessionId. 3. MarkdownText.MinisImageBlock had no decode-size cap, so a very tall PNG decoded at intrinsic size — the 215 MB bitmap / RecordingCanvas crash class already fixed on the streaming path (T-android-canvas-large-bitmap-crash) — and a broken file rendered as a silent blank gap instead of the T148 placeholder. MinisImageFetcher (Coil's last-line fallback for raw URLs) gets the candidate decode too, and stays on the global resolver deliberately: callers that know the session resolve to a File model before Coil sees a URL, so a raw URL reaching the fetcher means no session context existed. Also fixes the '+' → space bug in the DISPLAYED captions (filenameFromMdUrl / filenameFromUrl). Verified: 13 new unit tests pin the unified behavior (candidate walk with disk existence, '+' preserved, double-encoded recovered, basename fallback stays inside the owning session, global bucket probe); logic pre-validated with an equivalent simulation.
tall-1997
force-pushed
the
fix/minis-media-resolution-unify
branch
from
October 13, 2026 11:02
56c3176 to
c56c6af
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
用户报告的问题
逐条核实结论(证据在源码)
真实根因(3 个,全部修复)
[T-minis-decode-unify]
+→空格:媒体路径全部用java.net.URLDecoder(form-urlencoded 语义),文件名里的+被解码成空格 → 永远找不到文件。链接点击路径(ChatLinkResolver)早已修为手写 %XX 解码,媒体路径一直没跟上。顺带修复:
limitDisplaySize()(流式路径已修的 215MB 位图崩溃同类隐患)+→空格 bug验证
+保留、双重编码恢复、basename 回退不跨会话、全局桶探测)