test clean up and formatting

This commit is contained in:
Adam Hathcock
2026-05-05 16:57:15 +01:00
parent 2021a06626
commit 3b29de3954
3 changed files with 109 additions and 96 deletions

View File

@@ -9,7 +9,6 @@ namespace SharpCompress.Archives;
public static class IArchiveExtensions
{
/// <summary>
/// Gets the appropriate StringComparison for path checks based on the file system.
/// Windows uses case-insensitive file systems, while Unix-like systems use case-sensitive file systems.
@@ -76,12 +75,13 @@ public static class IArchiveExtensions
{
if (entry.IsDirectory)
{
var folder = Path.GetDirectoryName(entry.Key.NotNull("Entry Key is null"))
.NotNull("Directory is null");
var destdir = Path.GetFullPath(Path.Combine(fullDestinationDirectoryPath, folder));
.NotNull("Directory is null");
var destdir = Path.GetFullPath(
Path.Combine(fullDestinationDirectoryPath, folder)
);
if (!Directory.Exists(destdir) && seenDirectories.Add(destdir))
if (!Directory.Exists(destdir) && seenDirectories.Add(destdir))
{
if (!destdir.StartsWith(fullDestinationDirectoryPath, PathComparison))
{

View File

@@ -67,7 +67,8 @@ public static class IAsyncArchiveExtensions
IProgress<ProgressReport>? progress,
CancellationToken cancellationToken
)
{ var fullDestinationDirectoryPath = Path.GetFullPath(destinationDirectory);
{
var fullDestinationDirectoryPath = Path.GetFullPath(destinationDirectory);
options ??= new ExtractionOptions();
//check for trailing slash.
@@ -97,10 +98,12 @@ public static class IAsyncArchiveExtensions
if (entry.IsDirectory)
{
var folder = Path.GetDirectoryName(entry.Key.NotNull("Entry Key is null"))
.NotNull("Directory is null");
var destdir = Path.GetFullPath(Path.Combine(fullDestinationDirectoryPath, folder));
.NotNull("Directory is null");
var destdir = Path.GetFullPath(
Path.Combine(fullDestinationDirectoryPath, folder)
);
if (!Directory.Exists(destdir) && seenDirectories.Add(destdir))
if (!Directory.Exists(destdir) && seenDirectories.Add(destdir))
{
if (!destdir.StartsWith(fullDestinationDirectoryPath, PathComparison))
{