Skip to content
Merged
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
56a49cb
Added test for extracting zip files with invalid characters in Windows
oguzeldereli1 Mar 30, 2022
682dbe3
Removed faulty test case
oguzeldereli1 Mar 30, 2022
ebac56d
Removed redundant test cases, Added contents of the InvalidWindowsFil…
oguzeldereli1 Mar 30, 2022
feac6a7
Replaced "+"s to Path.Combine for forming the test file path.
oguzeldereli1 Mar 30, 2022
b8afbef
Update src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Extr…
danmoseley Mar 30, 2022
1e9ba60
Added code to use ValidFullName across several files
oguzeldereli1 Mar 31, 2022
d97c6a2
Merge branch 'Danyy427-ZipFile-Test' of https://github.com/Danyy427/r…
oguzeldereli1 Mar 31, 2022
eeac178
Removed weird character
oguzeldereli1 Mar 31, 2022
6fbf14d
Added Sanitization
oguzeldereli1 Apr 1, 2022
a36d344
Fixed Typo
oguzeldereli1 Apr 1, 2022
f55c3a0
Fixed wrong if statement
oguzeldereli1 Apr 2, 2022
db5102b
Fixed wrong filename in test
oguzeldereli1 Apr 2, 2022
dc7a5fa
Added sanitization as a method
oguzeldereli1 Apr 2, 2022
af95adb
Merge branch 'Danyy427-ZipFile-Test' of https://github.com/Danyy427/r…
oguzeldereli1 Apr 2, 2022
46b335b
Fixed tests that didn't pass
oguzeldereli1 Apr 8, 2022
6867258
Cleaned up code
oguzeldereli1 Apr 8, 2022
389289a
Removed unnecessary tests
oguzeldereli1 Apr 8, 2022
482bddc
Change agnostic TFM back to Windows
danmoseley Apr 10, 2022
d9b7f9a
spacing
danmoseley Apr 10, 2022
f8d75fc
Changed default target framework to Unix
oguzeldereli1 Apr 11, 2022
034466f
Defaulted framework to unix
oguzeldereli1 Apr 11, 2022
3046526
Removed Browser
oguzeldereli1 Apr 11, 2022
90b2e00
Update src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Crea…
danmoseley Apr 11, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,30 @@ public void Windows_ZipWithInvalidFileNames_ThrowsArgumentException(string zipNa
AssertExtensions.Throws<ArgumentException>("path", null, () => ZipFile.ExtractToDirectory(compat(zipName) + ".zip", GetTestFilePath()));
}

/// <summary>
/// This test checks whether or not ZipFile.ExtractToDirectory() is capable of handling filenames
/// which contain invalid path characters in Windows.
/// Archive: InvalidWindowsFileNameChars.zip
/// Length Date Time Name
/// --------- ---------- ----- ----
/// 0 2022-03-27 13:44 Test/
/// 12 2022-03-27 13:44 Test/normalText.txt
/// 0 2022-03-27 13:44 Test"<>|^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_/
/// 14 2022-03-27 13:44 Test"<>|^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_/TestText1"<>|^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_.txt
/// 0 2022-03-27 13:44 TestEmpty/
/// 14 2022-03-27 13:44 TestText"<>|^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_.txt
/// </summary>
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Windows_ZipWithInvalidFileNames()
{
var testDirectory = GetTestFilePath();
ZipFile.ExtractToDirectory(compat("InvalidWindowsFileNameChars.zip"), testDirectory);
Assert.True(File.Exists(testDirectory + "Test______________________________________.txt"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Path.Combine not + - see other tests.

Assert.True(File.Exists(testDirectory + "Test______________________________________/TestText1______________________________________.txt"));
Assert.True(File.Exists(testDirectory + "Test/normalText.txt"));
}

/// <summary>
/// This test ensures that a zipfile with path names that are invalid to this OS will throw errors
/// when an attempt is made to extract them.
Expand Down