chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.04k stars 890 forks source link

Install-ChocolateyFileAssociation creating unnecessary 3rd parameter in registry command, causing error in app when opening associated filetype #3444

Open mica opened 1 month ago

mica commented 1 month ago

Checklist

What You Are Seeing?

The value being created by Install-ChocolateyFileAssociation at HKEY_CLASSES_ROOT\infekt-win64.exe\Shell\Open\Command\ has one too many parameters ("path\to\exe" "%1" "%*" vs "path\to\exe" "%1"). This is causing the app to throw a "too many positional options have been specified" error when opening associated files.

What is Expected?

.nfo files should be able to open in the app without issue

How Did You Get This To Happen?

Here's part of the chocolateyInstall.ps1—hopefully enough to reproduce:

Install-ChocolateyZipPackage `
    -PackageName 'iNFekt' `
    -Url64 'https://syndicode.org/infekt/downloads/v1.3.0/iNFekt-v1.3.0-64bit-Portable.rar' `
    -Checksum64 '673B3AF9ED0E3DC42C6C2CD8308A815FCC3141C2D97EE9E4FA88E182AC56898E' `
    -ChecksumType64 'SHA256' `
    -UnzipLocation $env:ProgramFiles\iNFekt\

Install-ChocolateyFileAssociation `
    -Extension .nfo `
    -Executable $env:ProgramFiles\iNFekt\iNFekt-64bit-Portable\infekt-win64.exe 

You can create an empty .nfo text file and attempt to open it to reproduce the error message.

Then if you edit the value at HKEY_CLASSES_ROOT\infekt-win64.exe\Shell\Open\Command\, removing "%*", it will open fine.

System Details

pauby commented 1 month ago

@mica Can you go back amend your description above to include:

  1. Full reproducible steps for this in the 'How did you get this to happen'? Note that those steps must include everything that we need to do to reproduce it.
  2. Include the output you are seeing with the error message and the output from Chocolatey CLI when install the package in the 'Output Log' section above.

Without both of those we cannot look at this issue.

Thanks.

mica commented 1 month ago

Not sure how relevant it would be, as the error is within another program—one that just happens to crash if passed a third parameter, even when it's an empty string. For example, & .\infekt-win64.exe file.txt works fine, whereas & .\infekt-win64.exe file.txt "" doesn't.

The issue is that in line 78 of Install-ChocolateyFileAssociation.ps1, it's registering $fileType="$executable" "%1" "%*" where $fileType="$executable" "%1" would suffice.

pauby commented 1 month ago

@mica Just to be clear, without reproducible steps, we are unable to accept this issue.

mica commented 1 month ago

Ok, I've edited above, thanks!

github-actions[bot] commented 2 weeks ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue will be closed in 14 days if it continues to be inactive.