-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added test for extracting zip files with invalid characters in Windows #67332
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
Merged
Merged
Changes from 20 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 682dbe3
Removed faulty test case
oguzeldereli1 ebac56d
Removed redundant test cases, Added contents of the InvalidWindowsFil…
oguzeldereli1 feac6a7
Replaced "+"s to Path.Combine for forming the test file path.
oguzeldereli1 b8afbef
Update src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Extr…
danmoseley 1e9ba60
Added code to use ValidFullName across several files
oguzeldereli1 d97c6a2
Merge branch 'Danyy427-ZipFile-Test' of https://github.com/Danyy427/r…
oguzeldereli1 eeac178
Removed weird character
oguzeldereli1 6fbf14d
Added Sanitization
oguzeldereli1 a36d344
Fixed Typo
oguzeldereli1 f55c3a0
Fixed wrong if statement
oguzeldereli1 db5102b
Fixed wrong filename in test
oguzeldereli1 dc7a5fa
Added sanitization as a method
oguzeldereli1 af95adb
Merge branch 'Danyy427-ZipFile-Test' of https://github.com/Danyy427/r…
oguzeldereli1 46b335b
Fixed tests that didn't pass
oguzeldereli1 6867258
Cleaned up code
oguzeldereli1 389289a
Removed unnecessary tests
oguzeldereli1 482bddc
Change agnostic TFM back to Windows
danmoseley d9b7f9a
spacing
danmoseley f8d75fc
Changed default target framework to Unix
oguzeldereli1 034466f
Defaulted framework to unix
oguzeldereli1 3046526
Removed Browser
oguzeldereli1 90b2e00
Update src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Crea…
danmoseley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileValidFullName_Unix.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Text; | ||
|
|
||
| namespace System.IO.Compression | ||
| { | ||
| public static partial class ZipFileExtensions | ||
| { | ||
| internal static string SanitizeZipFilePath(string zipPath) | ||
| { | ||
| return zipPath.Replace('\0', '_'); | ||
| } | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
...aries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileValidName_Windows.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
|
|
||
| using System.Text; | ||
|
|
||
| namespace System.IO.Compression | ||
| { | ||
| public static partial class ZipFileExtensions | ||
| { | ||
| internal static string SanitizeZipFilePath(string zipPath) | ||
| { | ||
| StringBuilder builder = new StringBuilder(zipPath); | ||
| for (int i = 0; i < zipPath.Length; i++) | ||
| { | ||
| if (((int)builder[i] >= 0 && (int)builder[i] < 32) || | ||
| builder[i] == '?' || builder[i] == ':' || | ||
| builder[i] == '*' || builder[i] == '"' || | ||
| builder[i] == '<' || builder[i] == '>' || | ||
| builder[i] == '|') | ||
| { | ||
| builder[i] = '_'; | ||
| } | ||
| } | ||
| return builder.ToString(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.