Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expect ZipEntry clean name test to be positive #505

Merged
merged 1 commit into from
Aug 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions test/ICSharpCode.SharpZipLib.Tests/Zip/StreamHandling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ public void WriteZipStreamWithNoCompression([Values(0, 1, 256)] int contentLengt

[Test]
[Category("Zip")]
[Category("KnownBugs")]
public void ZipEntryFileNameAutoClean()
{
using (var dummyZip = Utils.GetDummyFile(0))
Expand All @@ -295,6 +294,7 @@ public void ZipEntryFileNameAutoClean()
using (var zipOutputStream = new ZipOutputStream(zipFileStream))
using (var inputFileStream = File.OpenRead(inputFile.Filename))
{
// New ZipEntry created with a full file name path as it's name
zipOutputStream.PutNextEntry(new ZipEntry(inputFile.Filename)
{
CompressionMethod = CompressionMethod.Stored,
Expand All @@ -305,11 +305,9 @@ public void ZipEntryFileNameAutoClean()

using (var zf = new ZipFile(dummyZip.Filename))
{
Assert.AreNotEqual(ZipEntry.CleanName(inputFile.Filename), zf[0].Name,
"Entry file name \"{0}\" WAS automatically cleaned, this test should be removed", inputFile.Filename);
// The ZipEntry name should have been automatically cleaned
Assert.AreEqual(ZipEntry.CleanName(inputFile.Filename), zf[0].Name);
}

Assert.Warn("Entry file name \"{0}\" was not automatically cleaned", inputFile.Filename);
}
}

Expand Down