- Home
- Plugins
- Tools & Capabilities
- dsh-zip-verify
dsh-zip-verify
lee2277-t/dsh-zip-verify
Check that a delivery zip really round-trips before you hand it over. `zip_verify` decompresses every entry, checks its CRC32, compares each file against a source directory by hash, and reports entry names that only decode as GBK or that carry an unflagged UTF-8 name; `zip_list` dumps the entries with size and compression method without verifying anything. It reads the central directory itself instead of trusting an external unzip, so a perfectly good Compress-Archive output is not mistaken for mojibake.
Install
dsh plugin --profile web add github:lee2277-t/dsh-zip-verifyREADME
dsh-zip-verify
交付包打出来之后,验证它真的能原样还原。
为什么
一个很正常的问题:用 Compress-Archive 打了个包,用 Git Bash 的 unzip 一看,
中文文件名全是乱码,还一堆告警。于是你以为包坏了,重新打一遍,还是一样。
包没坏,是解压工具解错了。 Compress-Archive 写的是 UTF-8 文件名,但经常不设 「UTF-8 标志位」,老工具就按系统代码页去解,于是乱码。
这个工具直接读 zip 的中央目录,按文件里的标志位判断该用什么编码,不给中间工具歪曲的机会。
两个工具
zip_verify
zip_verify D:\build\delivery.zip
4 entries · 599 B 解压后 · verdict: PASS
源目录 : D:\build\dist(4 个文件)
## 校验
逐条目解压 : 全部成功
CRC32 : 全部相符
压缩方式 : deflate
## 编码
3 个条目名是 UTF-8 内容但没打 UTF-8 标志位(兼容大部分解压工具,个别老工具会乱码)
## 问题
无 ✅
给 sourceDir 就逐文件对账:
## 问题
1 个文件内容不一致(sha256):
≠ js/app.js
四类问题分别报:缺文件、多文件、内容不一致、CRC 不符。
zip_list
只列条目,不校验。适合先看一眼包里到底装了什么。
几个实现细节
顶层目录自动剥离。 Compress-Archive 会把内容整包进一个与源目录同名的文件夹里,
于是包内路径是 dist/index.html 而源目录是 index.html。逐文件对账会全部失败。
这里会识别这种情况并提示「已剥离」,不是静默改路径。
Zip64。 超过 4 GB 或条目数超过 65535 时,32 位字段会溢出到 Zip64 扩展里。 解析器会读这些扩展,不会对着大包报「字段无效」。
不落盘解压。 条目在内存里 inflate,算完 CRC 和哈希就丢掉。不会在临时目录留一堆文件。
编码三级判定。 标志位说是 UTF-8 就按 UTF-8;没标志位但能按 UTF-8 解通,标成
utf-8 (recovered);解不通再试 GBK,都不行才退回 latin1。
安装
dsh plugin add github:Lee2277-t/dsh-zip-verify
配置
hash: sha256 # 对账哈希,也可用 md5
限制
- 只读:不创建、不修改 zip。
- 不支持分卷压缩包。
- 加密条目无法校验(会报解压失败,不会误判为通过)。
许可
AGPL-3.0-only。
Related plugins
archify (deepseek-harness)
tt-a1i/archify
WeKnora (dsh-weknora)
tencent/weknora
next-ai-draw-io (dsh-plugin)
dayuanjiang/next-ai-draw-io
weknora
tencent/weknora