fix: verify cache file against manifest FileCRC/FileSize instead of self-recorded .info values

This commit is contained in:
何冠峰
2026-06-02 16:09:20 +08:00
parent 93a9167100
commit 9d5f1b3aa4

View File

@@ -469,7 +469,9 @@ namespace YooAsset
if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element) == false)
return EFileVerifyResult.CacheNotFound;
EFileVerifyResult result = FileVerifyHelper.FileVerify(element.DataFilePath, element.DataFileSize, element.DataFileCRC, EFileVerifyLevel.High);
// 注意:使用清单里的权威校验值(与下载/解压时的校验基准一致),而不是缓存记录里来源于本地 .info 文件的自描述值,
// 否则数据文件与 .info 文件被一并篡改时仍会校验通过。
EFileVerifyResult result = FileVerifyHelper.FileVerify(element.DataFilePath, bundle.FileSize, bundle.FileCRC, EFileVerifyLevel.High);
return result;
}
public bool WriteCacheBundleFile(PackageBundle bundle, string copyPath)