Skip to content
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

Add method to extract nupkg to directory #1456

Merged
merged 4 commits into from
Oct 25, 2023

Conversation

alerickson
Copy link
Member

PR Summary

Some repositories (namely GitHub Packages) add an extra _rels\rels file to the .nupkgs. System.IO.Compression.ZipFile.ExtractToDirectory does not have an overwrite parameter for net472, so this method was throwing an exception every time it came across the second _rels\rels.

This PR opens the .nupkg and runs ExtractToFile (which does have an overwrite parameter) on each item so that no exception gets thrown. Note that anything under _rels by default gets thrown out by PSResourceGet, so overwriting this file is not an issue. There should be no other duplicate files.

PR Context

Resolves #1433

PR Checklist

@alerickson alerickson requested review from anamnavi and adityapatwardhan and removed request for anamnavi October 23, 2023 19:40
src/code/InstallHelper.cs Fixed Show fixed Hide fixed
Copy link
Member

@anamnavi anamnavi left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@adityapatwardhan adityapatwardhan left a comment

Choose a reason for hiding this comment

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

Look at the CodeQL error.

src/code/InstallHelper.cs Fixed Show fixed Hide fixed
@alerickson alerickson merged commit 122cdcb into PowerShell:master Oct 25, 2023
3 checks passed
@alerickson alerickson deleted the relsBug branch October 25, 2023 20:59
@jtomkiew-mng
Copy link

Slight correction to the description: GitHub Packages repository does not modify the nupkg files on it's own, but a certain popular tool does (wich results in a duplicated _rels/rels).

If you publish a valid nupkg to GitHub Packages directly, e.g. using dotnet nuget push, it will stay valid (i.e. no duplicated rels).

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.

Install-PSResource fails from GitHub package registry
4 participants