ZipFile.TestArchive() returns true for empty file
还没有人认领这个 Issue。
评估
调研方向
从 ZipFile.TestArchive 开始,跟踪通过 ZipFile 打开空 stream 时对其的处理方式。为一个重命名后的空 .txt stream 添加回归测试,然后验证 TestArchive 返回 false,同时确保非空文件的已报告行为仍然得到覆盖。
由索引模型根据 Issue 内容生成。
描述
Steps to reproduce
- Create Empty *.txt file and rename extension to *.zip
- Use OpenReadStream() and TestArchive(true, TestStrategy.FindFirstError, null)
Expected behavior
The method must return false
Actual behavior
Method returns true
Version of SharpZipLib
1.3.3
Obtained from (only keep the relevant lines)
- Package installed using NuGet
Notably, the method returns false if there is any information in the text file
My code:
public static bool IsCorrectZipFile(this IFormFile zipFile) //zipFile = emptyTxtFile.zip
{
try
{
bool result;
using (ZipFile zip = new ZipFile(zipFile.OpenReadStream()))
{
result = zip.TestArchive(true, TestStrategy.FindFirstError, null);
}
return result;
}
catch
{
return false;
}
}
- 主要语言
- C#
- 星标
- 3.9k
- 派生
- 1k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
icsharpcode/SharpZipLib 的其他 Issue
-
*no response* bug
难度 1/5 1 小时以内 新手友好度 78/100
icsharpcode/SharpZipLib#905 · 1 条评论 ·
-
bug bzip2
难度 4/5 3-5 天 新手友好度 45/100
icsharpcode/SharpZipLib#904 ·
-
enhancement zip
难度 2/5 1-2 天 新手友好度 55/100
icsharpcode/SharpZipLib#903 ·
-
*no response* bug
难度 4/5 3-5 天 新手友好度 32/100
icsharpcode/SharpZipLib#901 · 1 条评论 ·
-
*no response* bug
难度 4/5 3-5 天 新手友好度 35/100
icsharpcode/SharpZipLib#894 · 1 条评论 ·
查看 icsharpcode/SharpZipLib 的全部 Issue
相似的 Issue
-
bug frontend good first issue
难度 2/5 1-3 小时 新手友好度 75/100
-
NavigationViewItemAutomationPeer implements IInvokeProvider but never advertises the Invoke pattern 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
unoplatform/uno#24629 ·
-
agentic-workflows Needs: Triage :mag: State: In-PR
难度 2/5 1-3 小时 新手友好度 70/100
-
bug
难度 1/5 1 小时以内 新手友好度 90/100
-
Type: enhancement
难度 2/5 1-3 小时 新手友好度 65/100
apache/arrow-adbc#4809 ·