diff --git a/CHANGELOG.md b/CHANGELOG.md
index 08a15bda7c..f19e7662f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,16 @@
+## [v0.5.2](https://github.com/ScoopInstaller/Scoop/compare/v0.5.1...v0.5.2) - 2024-07-26
+
+### Bug Fixes
+
+- **scoop-alias:** Fix 'Option --verbose not recognized.' ([#6062](https://github.com/ScoopInstaller/Scoop/issues/6062))
+- **scoop-hold:** Use 'foreach' loop to allow 'continue' statement ([#6078](https://github.com/ScoopInstaller/Scoop/issues/6078))
+- **core:** Use 'Join-Path' to construct cache file path ([#6079](https://github.com/ScoopInstaller/Scoop/issues/6079))
+- **json:** Don't serialize jsonpath return if only one result ([#6066](https://github.com/ScoopInstaller/Scoop/issues/6066), [#6073](https://github.com/ScoopInstaller/Scoop/issues/6073))
+
+### Builds
+
+- **supporting:** Update Json.Schema to 4.0.1 ([#6072](https://github.com/ScoopInstaller/Scoop/issues/6072))
+
## [v0.5.1](https://github.com/ScoopInstaller/Scoop/compare/v0.5.0...v0.5.1) - 2024-07-16
### Bug Fixes
diff --git a/lib/core.ps1 b/lib/core.ps1
index 193a8c0020..23a10c32ed 100644
--- a/lib/core.ps1
+++ b/lib/core.ps1
@@ -407,7 +407,7 @@ function usermanifestsdir { "$(basedir)\workspace" }
function usermanifest($app) { "$(usermanifestsdir)\$app.json" }
function cache_path($app, $version, $url) {
$underscoredUrl = $url -replace '[^\w\.\-]+', '_'
- $filePath = "$cachedir\$app#$version#$underscoredUrl"
+ $filePath = Join-Path $cachedir "$app#$version#$underscoredUrl"
# NOTE: Scoop cache files migration. Remove this 6 months after the feature ships.
if (Test-Path $filePath) {
diff --git a/lib/install.ps1 b/lib/install.ps1
index 6c8c3ff11a..54b0922e26 100644
--- a/lib/install.ps1
+++ b/lib/install.ps1
@@ -238,7 +238,7 @@ function Invoke-CachedAria2Download ($app, $version, $manifest, $architecture, $
foreach ($url in $urls) {
$data.$url = @{
- 'target' = "$dir\$(url_filename $url)"
+ 'target' = Join-Path $dir (url_filename $url)
'cachename' = fname (cache_path $app $version $url)
'source' = cache_path $app $version $url
}
diff --git a/lib/json.ps1 b/lib/json.ps1
index d8d07f50a6..d6fd3621b5 100644
--- a/lib/json.ps1
+++ b/lib/json.ps1
@@ -110,7 +110,7 @@ function json_path([String] $json, [String] $jsonpath, [Hashtable] $substitution
# Return versions in reverse order
$result = [System.Linq.Enumerable]::Reverse($result)
}
- if ($single) {
+ if ([System.Linq.Enumerable]::Count($result) -eq 1 -or $single) {
# Extract First value
$result = [System.Linq.Enumerable]::First($result)
# Convert first value to string
diff --git a/libexec/scoop-alias.ps1 b/libexec/scoop-alias.ps1
index 4c07beeb1a..677b9337f7 100644
--- a/libexec/scoop-alias.ps1
+++ b/libexec/scoop-alias.ps1
@@ -39,7 +39,7 @@ if ($SubCommand -notin $SubCommands) {
exit 1
}
-$opt, $other, $err = getopt $Args 'v' , 'verbose'
+$opt, $other, $err = getopt $Args 'v' 'verbose'
if ($err) { "scoop alias: $err"; exit 1 }
$name, $command, $description = $other
diff --git a/libexec/scoop-hold.ps1 b/libexec/scoop-hold.ps1
index 43f11b3259..504f20a849 100644
--- a/libexec/scoop-hold.ps1
+++ b/libexec/scoop-hold.ps1
@@ -29,14 +29,13 @@ if ($global -and !(is_admin)) {
exit 1
}
-$apps | ForEach-Object {
- $app = $_
+foreach ($app in $apps) {
if ($app -eq 'scoop') {
$hold_update_until = [System.DateTime]::Now.AddDays(1)
set_config HOLD_UPDATE_UNTIL $hold_update_until.ToString('o') | Out-Null
success "$app is now held and might not be updated until $($hold_update_until.ToLocalTime())."
- return
+ continue
}
if (!(installed $app $global)) {
if ($global) {
@@ -44,7 +43,7 @@ $apps | ForEach-Object {
} else {
error "'$app' is not installed."
}
- return
+ continue
}
if (get_config NO_JUNCTION) {
diff --git a/libexec/scoop-virustotal.ps1 b/libexec/scoop-virustotal.ps1
index 026712e9cc..0782c7e225 100644
--- a/libexec/scoop-virustotal.ps1
+++ b/libexec/scoop-virustotal.ps1
@@ -36,8 +36,9 @@
$opt, $apps, $err = getopt $args 'asnup' @('all', 'scan', 'no-depends', 'no-update-scoop', 'passthru')
if ($err) { "scoop virustotal: $err"; exit 1 }
-if (!$apps -and -$all) { my_usage; exit 1 }
-$architecture = Format-ArchitectureString
+$all = $apps -eq '*' -or $opt.a -or $opt.all
+if (!$apps -and !$all) { my_usage; exit 1 }
+$architecture = Get-DefaultArchitecture
if (is_scoop_outdated) {
if ($opt.u -or $opt.'no-update-scoop') {
@@ -47,11 +48,8 @@ if (is_scoop_outdated) {
}
}
-$apps_param = $apps
-
-if ($apps_param -eq '*' -or $opt.a -or $opt.all) {
- $apps = installed_apps $false
- $apps += installed_apps $true
+if ($all) {
+ $apps = (installed_apps $false) + (installed_apps $true)
}
if (!$opt.n -and !$opt.'no-depends') {
@@ -102,14 +100,14 @@ Function Get-VirusTotalResultByHash ($hash, $url, $app) {
$response = Invoke-WebRequest -Uri $api_url -Method GET -Headers $headers -UseBasicParsing
$result = $response.Content
$stats = json_path $result '$.data.attributes.last_analysis_stats'
- [int]$malicious = json_path $stats '$[0].malicious' $null $false $true
- [int]$suspicious = json_path $stats '$[0].suspicious' $null $false $true
- [int]$timeout = json_path $stats '$[0].timeout' $null $false $true
- [int]$undetected = json_path $stats '$[0].undetected' $null $false $true
+ [int]$malicious = json_path $stats '$.malicious'
+ [int]$suspicious = json_path $stats '$.suspicious'
+ [int]$timeout = json_path $stats '$.timeout'
+ [int]$undetected = json_path $stats '$.undetected'
[int]$unsafe = $malicious + $suspicious
[int]$total = $unsafe + $undetected
- [int]$fileSize = json_path $result '$.data.attributes.size' $null $false $true
- $report_hash = json_path $result '$.data.attributes.sha256' $null $false $true
+ [int]$fileSize = json_path $result '$.data.attributes.size'
+ $report_hash = json_path $result '$.data.attributes.sha256'
$report_url = "https://www.virustotal.com/gui/file/$report_hash"
if ($total -eq 0) {
info "$app`: Analysis in progress."
diff --git a/supporting/validator/bin/Newtonsoft.Json.Schema.dll b/supporting/validator/bin/Newtonsoft.Json.Schema.dll
index 1185cf4503..766b9a1871 100644
Binary files a/supporting/validator/bin/Newtonsoft.Json.Schema.dll and b/supporting/validator/bin/Newtonsoft.Json.Schema.dll differ
diff --git a/supporting/validator/bin/Scoop.Validator.dll b/supporting/validator/bin/Scoop.Validator.dll
index d244e70241..ccf13bb0ff 100644
Binary files a/supporting/validator/bin/Scoop.Validator.dll and b/supporting/validator/bin/Scoop.Validator.dll differ
diff --git a/supporting/validator/bin/checksum.sha256 b/supporting/validator/bin/checksum.sha256
index bd4d44ad1b..c7db79ce23 100644
--- a/supporting/validator/bin/checksum.sha256
+++ b/supporting/validator/bin/checksum.sha256
@@ -1,4 +1,4 @@
e1e27af7b07eeedf5ce71a9255f0422816a6fc5849a483c6714e1b472044fa9d *Newtonsoft.Json.dll
-9f1a8f06c284a4ee01f704d89003ddc7061846f2008094071e9adf08267849f9 *Newtonsoft.Json.Schema.dll
-d11b660612ce821ec03772b73aa3b8884a0479275c70085c7e143913a41a2d28 *Scoop.Validator.dll
+7496d5349a123a6e3696085662b2ff17b156ccdb0e30e0c396ac72d2da36ce1c *Newtonsoft.Json.Schema.dll
+83b1006443e8c340ca4c631614fc2ce0d5cb9a28c851e3b59724299f58b1397f *Scoop.Validator.dll
87f8f8db2202a3fbef6f431d0b7e20cec9d32095c441927402041f3c4076c1b6 *validator.exe
diff --git a/supporting/validator/bin/checksum.sha512 b/supporting/validator/bin/checksum.sha512
index 0deec2c77b..c145b03a06 100644
--- a/supporting/validator/bin/checksum.sha512
+++ b/supporting/validator/bin/checksum.sha512
@@ -1,4 +1,4 @@
56eb7f070929b239642dab729537dde2c2287bdb852ad9e80b5358c74b14bc2b2dded910d0e3b6304ea27eb587e5f19db0a92e1cbae6a70fb20b4ef05057e4ac *Newtonsoft.Json.dll
-551e772fe2ee72b349d5c4ed5d5f8d8957d50cfcbbde7af5d5740d9652bcad626a2c00bc0d9223db7c874962187a90f9160397f243eadee1c594585ba2b155e0 *Newtonsoft.Json.Schema.dll
-0a31d192c82bbd8ce50fb75dd5fe813c98bb870d54c112c600ae2e2436063cb2bd94bb206675dfe31ce89922e9a04a3d520ed579ab7198835190b67a6321a74e *Scoop.Validator.dll
+78b12beb1e67ac4f6efa0fcba57b4b34ea6a31d8b369934d6b6a6617386ef9939ea453ac262916e5857ce0359eb809424ea33c676a87a8fdfd77a59b2ce96db0 *Newtonsoft.Json.Schema.dll
+e9da4370aee4df47eedcf15d9749712eee513e5a9115b808617ddfcfde5bc47a0410edfb57508fcf51033c0be967611b2fd2c2ba944de7290c020cc67f77ac57 *Scoop.Validator.dll
58a0c37e98cac17822c7756bf6686a5fb74e711b8d986d13bd2f689f6b3b1f485fcd908d92cbc6a162a0e5974c2c5a43de57d15f1996be0aa405e41ec2ec8393 *validator.exe
diff --git a/supporting/validator/packages.config b/supporting/validator/packages.config
index 333c8a4faf..09c665d668 100644
--- a/supporting/validator/packages.config
+++ b/supporting/validator/packages.config
@@ -1,6 +1,7 @@
-
-
+
+
diff --git a/supporting/validator/validator.csproj b/supporting/validator/validator.csproj
index a2c7978fff..5d3dde0b8f 100644
--- a/supporting/validator/validator.csproj
+++ b/supporting/validator/validator.csproj
@@ -1,8 +1,8 @@
+ Project="packages\Microsoft.Net.Compilers.Toolset.4.10.0\build\Microsoft.Net.Compilers.Toolset.props"
+ Condition="Exists('packages\Microsoft.Net.Compilers.Toolset.4.10.0\build\Microsoft.Net.Compilers.Toolset.props')" />
@@ -23,9 +23,8 @@
True
-
- packages\Newtonsoft.Json.Schema.3.0.15\lib\net45\Newtonsoft.Json.Schema.dll
+ Include="Newtonsoft.Json.Schema, Version=4.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
+ packages\Newtonsoft.Json.Schema.4.0.1\lib\net45\Newtonsoft.Json.Schema.dll
True
@@ -52,7 +51,7 @@
http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.
+ Condition="!Exists('packages\Microsoft.Net.Compilers.Toolset.4.10.0\build\Microsoft.Net.Compilers.Toolset.props')"
+ Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Net.Compilers.Toolset.4.10.0\build\Microsoft.Net.Compilers.Toolset.props'))" />