Skip to content

Commit

Permalink
fix(Checkver): Stabilize substitutions resolve
Browse files Browse the repository at this point in the history
Variables will be resolved from the longest to the shortest
  • Loading branch information
Ash258 committed May 29, 2021
1 parent c57e554 commit ae23574
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [0.6](https://github.com/Ash258/Scoop-Core/milestone/4)

### 0.6-pre4

- **Checkver**: Stabilize substitutions resolve
- i.e: `$urlNoExt` sometimes was faulty resolved as `${url}NoExt`
- Add additional debug for jsonpath/xpath evaluation
- **scoop-bucket**: Fix edge case when there are no buckets added

Expand Down
6 changes: 3 additions & 3 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ function Invoke-VariableSubstitution {
if ($null -ne $newEntity) {
switch ($newEntity.GetType().Name) {
'String' {
$Substitutes.GetEnumerator() | ForEach-Object {
$Substitutes.GetEnumerator() | Sort-Object { $_.Name.Length } -Descending | ForEach-Object {
$value = if (($EscapeRegularExpression -eq $false) -or ($null -eq $_.Value)) { $_.Value } else { [Regex]::Escape($_.Value) }
$curly = '${' + $_.Name.TrimStart('$') + '}'

Expand Down Expand Up @@ -1189,8 +1189,8 @@ $globaldir = $SCOOP_GLOBAL_ROOT_DIRECTORY
$cachedir = $SCOOP_CACHE_DIRECTORY
$scoopConfig = $SCOOP_CONFIGURATION
$configFile = $SCOOP_CONFIGURATION_FILE

# Do not use the new native command parsing PowerShell/PowerShell#15239, Ash258/Scoop-Core#142
xy globally
setup_proxysetup_proxy
$PSNativeCommandArgumentPassing = 'Legacy'

# Setup proxy globally
Expand Down

0 comments on commit ae23574

Please sign in to comment.