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

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

Open
6 tasks done
mica opened this issue May 17, 2024 · 4 comments

Comments

@mica
Copy link

mica commented May 17, 2024

Checklist

  • I confirm there are no unresolved issues reported on the Chocolatey Status page.
  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.
  • I confirm I am using official, and not unofficial, or modified, Chocolatey products.

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

  • Operating System: Windows 10.0.19045.0
  • Windows PowerShell version: 7.4.2
  • Chocolatey CLI Version: 2.2.2
  • Chocolatey Licensed Extension version: 2.2.2
  • Chocolatey License type: ?
  • Terminal/Emulator: pwsh
@mica mica added the Bug label May 17, 2024
@pauby
Copy link
Member

pauby commented May 17, 2024

@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
Copy link
Author

mica commented May 17, 2024

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
Copy link
Member

pauby commented May 17, 2024

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

@mica
Copy link
Author

mica commented May 19, 2024

Ok, I've edited above, thanks!

@mica mica changed the title Install-ChocolateyFileAssociation 3rd parameter in registry command causing error when opening file Install-ChocolateyFileAssociation creating unnecessary 3rd parameter in registry command, causing error in app when opening associated filetype May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants