Skip to content

Commit

Permalink
Merge pull request #51 from Arlodotexe/fix/compression/deleteasync
Browse files Browse the repository at this point in the history
Fixed file handling on ZipArchiveFolder.DeleteAsync
  • Loading branch information
Arlodotexe authored Apr 3, 2024
2 parents 81da8ca + 842d99e commit 8e6d312
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
15 changes: 11 additions & 4 deletions src/OwlCore.Storage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

<Author>Arlo Godfrey</Author>
<Version>0.10.0</Version>
<Version>0.10.1</Version>
<Product>OwlCore</Product>
<Description>The most flexible file system abstraction, ever. Built in partnership with the UWP Community.

Expand All @@ -23,6 +23,13 @@
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIcon>logo.png</PackageIcon>
<PackageReleaseNotes>
--- 0.10.1 ---
[Fixes]
Fixed an issue where ZipArchiveFolder.DeleteAsync wasn't handling files correctly.

[Improvements]
Update all dependencies to latest versions.

--- 0.10.0 ---
THIS IS A BREAKING RELEASE
Update asap, and do not use older versions or implementations.
Expand Down Expand Up @@ -254,9 +261,9 @@ Initial release of OwlCore.Storage.
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="PolySharp" Version="1.13.1">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
12 changes: 12 additions & 0 deletions src/System/IO/Compression/ZipArchiveFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,23 @@ public async Task DeleteAsync(IStorableChild item, CancellationToken cancellatio
{
var entry = TryGetEntry(readOnlyFolder.Path);

if (entry is null)
throw new FileNotFoundException("The item was not found in the folder.");

entry.Delete();
}
else if (item is ZipArchiveEntryFile file)
{
var entry = TryGetEntry(file.Name);
if (entry is null)
throw new FileNotFoundException("The item was not found in the folder.");
else
entry.Delete();
}
else
{
throw new ArgumentException("The item is not a valid child of this folder.", nameof(item));
}
}

/// <inheritdoc/>
Expand Down
6 changes: 3 additions & 3 deletions tests/OwlCore.Storage.Tests/OwlCore.Storage.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.TestPlatform" Version="17.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.2.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.2.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="OwlCore.Storage.CommonTests" Version="0.5.0" />
<PackageReference Include="OwlCore.Storage.CommonTests" Version="0.5.1" />
<ProjectReference Include="..\..\src\OwlCore.Storage.csproj" />
</ItemGroup>

Expand Down

0 comments on commit 8e6d312

Please sign in to comment.