Skip to content

Conversation

o-l-a-v
Copy link
Contributor

@o-l-a-v o-l-a-v commented Sep 19, 2024

PR Summary

Fixes #1659.

I noticed that the example problematic package Microsoft.Web.WebView2 ( https://www.nuget.org/packages/Microsoft.Web.WebView2 ) mentioned by the creator of the issue, contained directories when doing ZipFile.OpenRead and looking at the entries. Non-problematic packages, like NuGet.Versioning ( https://www.nuget.org/packages/NuGet.Versioning ) did not.

image

Solution: Filter out entries where length is less than or equal to 0 (because they are not files).

PR Context

See previous chapter.

PR Checklist

@o-l-a-v o-l-a-v changed the title Don't treat directories (entries without content) as files Fix 1659 "Some Nuget packages fail to extract" Sep 19, 2024
@o-l-a-v
Copy link
Contributor Author

o-l-a-v commented Sep 19, 2024

We should probably add a test to make sure this does not happen again? But you probably want another "test_modulex" rather testing by fetching Microsoft.Web.WebView2 ( https://www.nuget.org/packages/Microsoft.Web.WebView2 )?

Must be a .nupkg where ZipFile.OpenRead will have entries where CompressedLength is less than 1, a.k.a a directory.

@alerickson alerickson merged commit 913a92e into PowerShell:master Oct 10, 2024
4 checks passed
@alerickson
Copy link
Member

So funny enough, when I tried to create a similarly structured .nupkg I wasn't able to repro the issue-- the only entries displayed were files and not directories.
image

I added a version of Microsoft.Web.WebView2 that is definitely reproducing the error and added a test to the local repository test file to validate it can install properly.

Thanks for fixing this bug!

@o-l-a-v o-l-a-v deleted the fix-1659 branch October 23, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some Nuget packages fail to extract

2 participants