microsoft / winget-create

The Windows Package Manager Manifest Creator command-line tool (aka wingetcreate)
MIT License
489 stars 84 forks source link

ZIP Packages update autonomously but not in interactive mode #397

Closed mdanish-kh closed 1 year ago

mdanish-kh commented 1 year ago

Brief description of your issue

Interactive update uses a call to ParsePackageAndUpdateInstallerNode() to Parse the InstallerType of an installer.

https://github.com/microsoft/winget-create/blob/5ec4ad62c6434934c3d630d589bf9c2bf767e264/src/WingetCreateCLI/Commands/UpdateCommand.cs#L724

This uses the Vestris.ResourceLib to parse the installer and retrieve its InstallerType. For zip installers in interactive updates, this seem to throw a Win32 Exception and interactive update returns Failed to parse the package from [<InstallerUrl>] at:

https://github.com/microsoft/winget-create/blob/5ec4ad62c6434934c3d630d589bf9c2bf767e264/src/WingetCreateCore/Common/PackageParser.cs#L703-L710

which is called from: https://github.com/microsoft/winget-create/blob/5ec4ad62c6434934c3d630d589bf9c2bf767e264/src/WingetCreateCore/Common/PackageParser.cs#L283-L285

This is because the path passed to the ResourceLib is path to the ZIP archive ending in .zip and not the actual installer present in the archive.

Steps to reproduce

Unattended update: (Dummy version used to simulate update)

  1. Nested nullsoft
wingetcreate update Guru3D.Afterburner -v 18.0 --urls "https://download-eu2.guru3d.com/afterburner/[Guru3D.com]-MSIAfterburnerSetup465.zip"
  1. Nested MSI
wingetcreate update aluxnimm.outlookcaldavsynchronizer -v 18.0 --urls "https://github.com/aluxnimm/outlookcaldavsynchronizer/releases/download/v4.3.0/OutlookCalDavSynchronizer-4.3.0.zip"
  1. Nested Portable
wingetcreate update Hugo.Hugo -v 18.0 --urls "https://github.com/gohugoio/hugo/releases/download/v0.112.7/hugo_0.112.7_windows-amd64.zip" "https://github.com/gohugoio/hugo/releases/download/v0.112.7/hugo_0.112.7_windows-arm64.zip"
  1. Nested portable
wingetcreate update Istio.Istio -v 18.0 --urls "https://github.com/istio/istio/releases/download/1.17.3/istioctl-1.17.3-win.zip"

Notice they all succeed in autonomous update. Now try the same packages in interactive update i.e.,

wingetcreate update Guru3D.Afterburner -v 18.0 -i wingetcreate update aluxnimm.outlookcaldavsynchronizer -v 18.0 -i wingetcreate update Hugo.Hugo -v 18.0 -i wingetcreate update Istio.Istio -v 18.0 -i

Expected behavior

Interactive update should succeed like the autonomous ones

Actual behavior

Interactive updates gives Failed to parse the package from [<InstallerUrl>] after downloading the package from URL.

Environment

Windows Package Manager Manifest Creator v1.2.7.0