Repository navigation
Conversation
ModAVD#286 把实例的应用清单(包名、应用名、UID)存进 mas-avd.json,全量问题包 复制这份文件时会把它剔掉;但文件解析不了时,copyMetadata 原样复制, 清单就跟着进了 ZIP。 现在先把文件拷到打包目录外的临时文件里解析、剔除,只把干净的副本写进 问题包。解析不了、或者剔完还能找到 appProxyPackages(不在 instances.<i> 下面),就不附 mas-avd.json,收集日志里记一行「未附 mas-avd.json」, 其他诊断照常带上。不带清单的文件照旧原样复制。 测试改成核最终 ZIP:mas-avd.json 写坏且带清单时,ZIP 里没有这份文件、 任何文件里都没有清单,summary 里有那一行。 Refs ModAVD/ModAVD#434
Collaborator
总体结论:修改后合并以下仅供参考 这版先在打包目录外处理元数据,测试也直接查了最终 ZIP。普通损坏文件不再因为解析失败就把已识别的清单塞回包里,这条修法是对的。 [逻辑 · P2] 脱敏前仍用原始文本判断「没有应用清单」。阻断合并:是。 copyMetadata 只有搜到键名原文才解析;对同一个 JSON 字段的等价编码,原文检索和解析器可能给出不同结果,未检出时会把原文件直接写进 ZIP。问题包要的是「确认不带清单」,不是「没搜到那串字」。建议先解析再按键处理,解析不可信就只省掉这份附件,其他诊断照带;最终 ZIP 的回归再覆盖非默认序列化的配置。 dot酱敬上 |
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.
#286 把实例的应用清单(包名、应用名、UID)存进了
mas-avd.json。全量问题包复制这份文件时会把清单剔掉,但文件解析不了时,copyMetadata会原样复制,清单就跟着进了 ZIP。这是 dot酱 在 #286 最后一轮、ModAVD/ModAVD#456 两轮里报的 P2,#286 合并时这条还没修。改法:
mas-avd.json拷到打包目录外的临时文件里解析、剔除清单,只把干净的副本写进问题包。appProxyPackages(清单不在instances.<i>下面),就不附mas-avd.json,收集日志里记一行「未附 mas-avd.json:它解析不了,里面的应用清单去不掉」,其他诊断照常带上。测试
go test ./internal/report:main 上和release/0.47上都通过。go vet ./internal/report ./internal/appproxy无输出。TestCollectWithholdsBrokenMetadata走完整的全量导出:mas-avd.json写坏且带清单时,最终 ZIP 里没有这份文件,任何文件里都没有清单里的包名,summary.txt里有「未附 mas-avd.json」。TestCopyMetadataBadFile覆盖三种情况:errMetadataWithheld;instances.<i>下:同上;return errMetadataWithheld分别改回「把原文写进问题包」,两次都有测试失败(第一处:上面两个测试都失败;第二处:「清单不在 instances 下」那一条失败)。Refs ModAVD/ModAVD#434