Repository navigation
fix(search): keep offering files the mirror has no Mod link for - #103
Open
std-external wants to merge 1 commit into
Open
std-external wants to merge 1 commit into
std-external wants to merge 1 commit into
Conversation
社区搜索里点下载显示「文件列表为空」:云端结果的文件带着完整的 GameBanana file id 和镜像下载地址,但 picker 只保留 mods 非空的文件, 而镜像现在把 mods 返回成空数组(/api/v2/mod/list 只剩它自己托管的 Mod,文件与 Mod 的对应关系没了),于是每个 Mod 的文件都被过滤掉。 现在 mods 为空也照常列出文件,名字退回文件说明(空则用投稿名), 没有 mods 信息就不按 Mod 去重、不高亮「已安装」;只有 mods 能给出去重 依据时才沿用旧逻辑。 顺带修掉单文件快捷路径把 id "-1" 当 GameBanana file id 用的问题: 只由镜像托管的文件现在把 URL 交给下载器,不再请求 gamebanana-files/-1(返回「文件未找到」)。
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.
问题
社区搜索(云端结果)里点下载,弹窗只显示「文件列表为空」,Mod 装不上。群友反馈 + 截图见 #1140733 的讨论(Celeste 蔚蓝制图群)。
原因
云端结果的文件本身是完整的(有 GameBanana file id、镜像下载地址、大小),但
ModList.createModInfo的downloadUrl只保留mods非空的文件:mods是镜像给出的「这个 zip 里装了哪些 Everest Mod」,它来自镜像的 Mod 目录。现在镜像的/api/v2/mod/list只返回它自己托管的那一个 Mod,文件与 Mod 的对应关系整体没了,于是所有云端文件的mods都是[],列表被过滤空 → 「文件列表为空」。实测(当前镜像数据):
CelesteNet(3 个文件)、Darkmoon Ruins、the road less traveled、Crossover Collab在旧逻辑下全部得到 0 个文件,修复后分别得到 3 / 1 / 3 / 7 个。修复
新增
src/downloadFiles.ts里的pickDownloadFiles():把原来内联在组件里的选取逻辑提出来,mods为空时照常列出文件,名字退回文件说明(description,空则用投稿名);只有拿得到mods时才按 Mod 去重、才判断「已安装」(空数组的every()恒真,旧代码会误判成已安装)。顺带修掉单文件快捷路径:
down(file.name, file.id)会把"-1"当 GameBanana file id 交给下载器,只由镜像托管的文件(EXCLUSIVE_MOD)因此去请求gamebanana-files/-1,镜像直接回{"code":10002,"message":"文件未找到"}。现在单选和多选走同一套判断:id为-1时交 URL。验证
pnpm --dir src/celemod-ui typecheck通过src/downloadFiles.test.ts(pnpm --dir src/celemod-ui test:download-files,4 个用例):Mod 去重/主文件、mods为空时不清空、WEGFan-only 投稿返回-1+ URL、无文件返回空gamebanana-files/<id>与files/<id>都能正常 302 到存储,gamebanana-files/-1则是「文件未找到」未处理
镜像的 Mod 目录本身变空(
/api/v2/mod/list只剩一条)是上游数据问题,本地目录页因此几乎没内容,属于另一件事,不在这个 PR 里。