Repository navigation
fix(weibo): normalize sinaweibo links, conflict diff links, and legacy false positives - #106
Merged
Merged
Conversation
…y false positives Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Owner
Author
|
Agent:已完成对 PR #106( 结论:先修复(存在 1 项 P1 与 1 项 P2 阻塞问题) 阻塞问题
已确认通过的审查范围
非阻塞建议(至多 2 条)
修复上述 P1 与 P2 并通过完整门禁与远端 CI 后,请通知复审(仅复核阻塞项即可)。 |
…nline urls Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Owner
Author
|
Agent:已完成对 PR #106 阻塞修复提交 结论:可合并(低风险) 阻塞项复核结果
未覆盖项(
|
chialecode
added a commit
that referenced
this pull request
Nov 25, 2026
Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
4 of 5 tasks
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.
Closes #102
做了什么
按 Issue #102(关联 DEC-073、DEC-076)完成三项修复与文档同步:
sinaweibo://白名单安全转换与超话超链接解析(internal/site/weibo/links.go、internal/service/dto.go、internal/ui/rich_text.go):NormalizeWeiboJumpURL(经RewriteSafeSinaWeiboAppURL)将安全的sinaweibo://pageinfo?containerid=<cid>...(校验^[A-Za-z0-9][A-Za-z0-9_-]{5,63}$且不含控制字符、用户凭证或签名/Cookie 参数)规范转为https://weibo.com/p/<cid>,并将sinaweibo://userinfo?uid=<5~19位正数字>规范转为https://weibo.com/u/<uid>;其余未知sinaweibo://路径、javascript:、file:、凭证与签名流地址继续严格拒绝。extractWeiboTextAndLinks:当url_struct仅含ori_url: "sinaweibo://pageinfo?containerid=..."(long_url为空、为t.cn或同为sinaweibo://)且正文含#名称[超话]#或名称超话时,稳定输出干净文本名称超话与安全的site.TextLink。internal/ui/rich_text.go旧缓存回退解析器:离线展示已落盘的标题 (sinaweibo://pageinfo?containerid=...)/标题 (sinaweibo://userinfo?uid=...)时自动识别并转换为可点击的安全桌面 HTTPS 超链接。(URL)冲突误报修复与既有误报自动消解(internal/download/conflict_contract.go、internal/library/library.go、internal/library/schema.go、internal/service/cache_conflicts*.go、internal/service/backend.go):NormalizeConflictText:兼容剥离 DEC-073 之前旧缓存正文中的内联尾缀(sinaweibo://...)、(https://...)、(http://...)(及全角括号变体)与#名称[超话]#标记并归一化空白,同时对真正编辑过的正文仍如实报冲突。InspectCacheConflictDiff/ 全量检查)时,若pending的纯文字冲突(text_edited且无媒体变更)经新规则校验仅差旧格式内联 URL(离线通过RemoteFingerprintSHA-256 精确匹配,实时复核/巡检比对实况正文与媒体),自动将本地item.json清洗补写为规范text+ 安全links[](经SaveItemMetadataOnly,保留原cachedAt与其余字段、不触碰媒体文件、item.json保持 v1),并自动移除该误报冲突。internal/service/cache_conflicts_types.go、internal/service/cache_conflicts_diff.go、internal/ui/tasks_conflicts_diff_modal.go、tools/uishots/fixtures.go):CacheConflictDiffDTO补充安全过滤后的LocalLinks/RemoteLinks(绝不写入cache-conflicts.json,过滤签名媒体流、Cookie 与非 HTTP(S) 协议)。ValidateSafeJumpURL在系统浏览器安全打开;仅一侧有链接时另一侧显式展示“(无超链接)”)。docs/research/weibo.md§4.2 与docs/ui.md§3、§3.6。验证
go test -count=1 ./internal/site/weibo ./internal/download ./internal/library ./internal/service ./internal/ui:全部通过(新增覆盖sinaweibo://正反用例、ori_url超话解析、离线旧缓存回退渲染、旧缓存内联 URL 冲突归一化、离线与实时自动消解及item.json迁移、对比弹窗超链接点击与不对称展示及 720px 窄窗无溢出)。go run ./tools/uishots:生成并校验全部 312 张截图(含更新后的tasks-conflicts-diff-{1280,1000,720}x860.png,已人工目视复核 1280px 与 720px 超链接胶囊排版无溢出)。go run ./tools/check:ALL CHECKS PASSED in 8m29.039s(gofmt、go vet、go test ./...、依赖方向、trace-serverLinux 构建、tools/checkdocs、git diff --check全绿)。origin/main(33bfaf5)后复跑go run ./tools/checkdocs与git diff --check origin/main通过;所有 21 个变更文件均为纯 LF(CR=0)。go run ./tools/check,为避免pre-push钩子重复耗时及GIT_DIR环境变量干扰tools/release测试(见LESSONS.md),本次推送使用git push --no-verify,远端 CI 仍由repository-quality全量校验。风险
item.json与cache-conflicts.json均保持version: 1不升结构版本;未触碰internal/credential、tools/package、tools/actcheck、.github/等高风险清单;零真实站点请求;无测试弱化)。risk:high,等用户合并)每个提交都带
Signed-off-by(git commit -s)。