Skip to content

Commit

Permalink
Fix ProtonDrive
Browse files Browse the repository at this point in the history
Fix to handle duplicate Sha512Checksum key in the update feed
  • Loading branch information
aaronparker committed Jul 7, 2024
1 parent 0f0a91c commit eba0564
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Evergreen/Apps/Get-ProtonDrive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ function Get-ProtonDrive {
}
$Updates = Invoke-EvergreenRestMethod @params

# Update feed may include duplicate keys in the JSON
# Convert the update JSON string
if ($Updates -is [System.String]) {
$Updates = $Updates | ConvertFrom-Json -ErrorAction "Stop"
try {
$Updates = $Updates | ConvertFrom-Json -ErrorAction "Continue"
}
catch {
# Update feed may include duplicate keys in the JSON
$Updates = $Updates -creplace $res.Get.Update.ReplaceString, "" | ConvertFrom-Json -ErrorAction "Stop"
}
}

# Sort for the latest version
Expand Down
3 changes: 2 additions & 1 deletion Evergreen/Manifests/ProtonDrive.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"Get": {
"Update": {
"Uri": "https://proton.me/download/drive/windows/version.json",
"DatePattern": "yyyy-MM-dd"
"DatePattern": "yyyy-MM-dd",
"ReplaceString": "(\\s+\\\"Sha512Checksum\\\":\\s+\\\".*\\\"\\,)"
}
},
"Install": {
Expand Down

0 comments on commit eba0564

Please sign in to comment.