choco
choco copied to clipboard
Add checksum verification for "file:" protocol in Get-ChocolateyWebFile
Checklist
- [X] I have verified this is the correct repository for opening this issue.
- [X] I have verified no other issues exist related to my request.
Is Your Feature Request Related To A Problem? Please describe.
Installers stored on local file systems or shares typically will copy quite fast so it's not much of an issue to run them directly from their current location like what Install-ChocolateyInstallPackage does. But increasingly people are working over VPNs or may have slow network connections to "local" shares (hosted on OneDrive for example). It would be desirable for Chocolatey to check if a previously downloaded installer is the same as the one it is trying to run and use the one it has already instead of downloading it again.
Describe The Solution. Why is it needed?
The Install-ChocolateyPackage
function calls the Get-ChocolateyWebFile
function to download the file, When it downloads http/s
protocols, it checks the checksum before it downloads to save time if it has already been downloaded .
However, when it downloads from a file:
protocol, it does not do this.
I propose that the checksum checking before download is also added to the file:///
protocol so that the benefit gained when it is used over the web is also gained for "local" files.
Additional Context
This request is distinct from simply running a hash check on the file once it's downloaded, this can be done using Install-ChocolateyPackage
instead of Install-ChocolateyInstallPackage
and using the file:///
prefix in the url
parameters. I want it to check the hash before the file is downloaded and at the moment this only occurs for http/s
locations.
Presently this issue has a work-around by using Get-ChecksumValid
or the standard PowerShell Get-FileHash
function and some extra lines in the chocolateyInstall.ps1
file, but it would be nice if it was integrated into the install functions.
Related Issues
https://github.com/chocolatey/choco/issues/1635