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

fix(shim): Check literal path in Get-ShimPath #5680

Merged
merged 2 commits into from
Oct 10, 2023

Conversation

lewis-yeung
Copy link
Contributor

@lewis-yeung lewis-yeung commented Oct 9, 2023

Description

A run of scoop shim info scoo* shows this:

Name     : scoo*
Path     : <SCOOP_ROOT>\shims\scoo*.ps1
Source   : scoop
Type     : ExternalScript
IsGlobal : False
IsHidden : True

Related code:

function Get-ShimPath($ShimName, $Global) {
'.shim', '.ps1' | ForEach-Object {
$shimPath = Join-Path (shimdir $Global) "$ShimName$_"
if (Test-Path $shimPath) {
return $shimPath
}
}
}

A name containing wildcard characters (e.g., *) is directly passed to Get-ShimPath here and the returned path still contains wildcard characters.

This is not expected according to the usage of scoop shim info <shim_name>. No characters should be interpreted as wildcard characters here.

Motivation and Context

Fix the bug.

How Has This Been Tested?

Run:

scoop shim info scoo*
scoop shim info scoo* -g

Output:

ERROR: Local shim not found: scoo*
ERROR: Global shim not found: scoo*

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

@lewis-yeung lewis-yeung changed the title fix(scoop-shim): Check literal path in Get-ShimPath fix(shim): Check literal path in Get-ShimPath Oct 9, 2023
niheaven
niheaven previously approved these changes Oct 9, 2023
@rashil2000 rashil2000 merged commit 14b38b4 into ScoopInstaller:develop Oct 10, 2023
2 checks passed
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.

3 participants