Thumbnail logo detection ignores logos already recorded in manifest.shared
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 84/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js
调研方向
阅读 site/thumbs.mjs:311-318 中处理共享 logo 的循环,以及 site/lib/thumbs.mjs:162-172 中的 sharedImageIds,然后查看 site/lib/lib.test.mjs 中现有的 sharedImageIds 测试。为一个哈希已存在于 shared 中的新记录添加测试,并运行 npm test。新记录被移至 shared 且测试通过,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
The three-or-more shared-hash rule that keeps publisher logos out of thumbnails only counts records fetched in the current run, so a logo that was already dropped into manifest.shared is accepted again when a single new entry from the same site is fetched.
Where
site/thumbs.mjs:311-318(logo drop loop)site/thumbs.mjs:263-266(shared skip)site/lib/thumbs.mjs:162-172(sharedImageIds)
Details
for (const id of sharedImageIds(thumbs)) { // counts hashes in `thumbs` only
shared[id] = thumbs[id];
delete thumbs[id];
pending.delete(id);
}
for (const id of Object.keys(thumbs)) delete shared[id];
Records dropped in an earlier run live in shared, not thumbs, so they never count toward the limit again. The existing test (site/lib/lib.test.mjs, the sharedImageIds case) only covers three records sitting in thumbs together.
Impact
A publisher's site-wide logo or social card is published as an asset preview with a "Preview image shown under " credit, which is the case the shared-hash rule (#132) exists to block.
Steps to reproduce
- Entries A, B and C on one site share an og:image; a run drops them into
manifest.shared. - Add entry D from the same site (or change A's
url). - Run
node site/thumbs.mjs: D's image hash appears once inthumbs, below the limit, so D keeps the logo. Pure check:sharedImageIds({ D: { hash: "h" } })is empty even whensharedholds three records with hashh.
Suggested fix
Count hashes across { ...shared, ...thumbs } and drop only the ids that are in thumbs; or keep a set of known logo hashes and reject any fetched image whose hash is in it.
Acceptance criteria
- A newly fetched record whose hash matches a hash already in
sharedis moved toshared - Unit test: one new record plus an already recorded shared hash
Getting started
- Relevant files:
site/thumbs.mjs,site/lib/thumbs.mjs,site/lib/lib.test.mjs - Run the tests:
npm test; the full local gate isnpm run check(Node 22+, no install step) - Related docs:
CONTRIBUTING.md,site/README.md
Related: #232, #132
Filed by repo-audit/full-audit at 4adb944. Severity: medium. Effort: S. audit-key: bug|site/thumbs.mjs|sharedImageIds
- 主要语言
- JavaScript
- 星标
- 58
- 派生
- 15
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 12
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TMHSDigital/Free-Game-Dev-Assets 的其他 Issue
-
enhancement good first issue priority: medium
难度 2/5 1-3 小时 新手友好度 82/100
TMHSDigital/Free-Game-Dev-Assets#272 ·
维护者通常 1 天内回复
-
documentation good first issue priority: low
难度 2/5 1-3 小时 新手友好度 78/100
TMHSDigital/Free-Game-Dev-Assets#270 ·
维护者通常 1 天内回复
-
documentation priority: medium
难度 2/5 1-3 小时 新手友好度 82/100
TMHSDigital/Free-Game-Dev-Assets#269 ·
维护者通常 1 天内回复
-
good first issue priority: low tests
难度 2/5 1-3 小时 新手友好度 88/100
TMHSDigital/Free-Game-Dev-Assets#267 ·
维护者通常 1 天内回复
-
good first issue priority: low tests
难度 2/5 1-3 小时 新手友好度 83/100
TMHSDigital/Free-Game-Dev-Assets#266 ·
维护者通常 1 天内回复
查看 TMHSDigital/Free-Game-Dev-Assets 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
guybedford/es-module-lexer#266 ·
-
bug documentation
难度 1/5 1-3 小时 新手友好度 88/100
apify/apify-docs#3206 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 90/100
anhnt256/cursor-swarm#21 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 74/100
zerohourzulu/irontrellis#16 ·