From 4423ef78913265c652249182d28ef191f70e5ac9 Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Tue, 8 Mar 2022 00:20:48 +0100 Subject: [PATCH] Fix system execution possible issue #22 --- Winget-AutoUpdate/winget-upgrade.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Winget-AutoUpdate/winget-upgrade.ps1 b/Winget-AutoUpdate/winget-upgrade.ps1 index b4f0c79..23b7fcb 100644 --- a/Winget-AutoUpdate/winget-upgrade.ps1 +++ b/Winget-AutoUpdate/winget-upgrade.ps1 @@ -57,8 +57,8 @@ function Write-Log ($LogMsg,$LogColor = "White") { function Start-NotifTask ($Title,$Message,$MessageType,$Balise) { -#Add XML variables -[xml]$ToastTemplate = @" + #Add XML variables + [xml]$ToastTemplate = @" @@ -246,7 +246,7 @@ function Start-WAUUpdateCheck{ else{ #Get Github latest version $WAUurl = 'https://api.github.com/repos/Romanitho/Winget-AutoUpdate/releases/latest' - $LatestVersion = (Invoke-WebRequest $WAUurl | ConvertFrom-Json)[0].tag_name + $LatestVersion = (Invoke-WebRequest $WAUurl -UseBasicParsing | ConvertFrom-Json)[0].tag_name [version]$AvailableVersion = $LatestVersion.Replace("v","") #If newer version is avalable, return $True @@ -264,7 +264,7 @@ function Start-WAUUpdateCheck{ function Update-WAU{ #Get WAU Github latest version $WAUurl = 'https://api.github.com/repos/Romanitho/Winget-AutoUpdate/releases/latest' - $LatestVersion = (Invoke-WebRequest $WAUurl | ConvertFrom-Json)[0].tag_name + $LatestVersion = (Invoke-WebRequest $WAUurl -UseBasicParsing | ConvertFrom-Json)[0].tag_name #Send available update notification $Title = $NotifLocale.local.outputs.output[2].title -f "Winget-AutoUpdate" @@ -312,7 +312,7 @@ function Update-WAU{ Start-NotifTask $Title $Message $MessageType $Balise #Rerun with newer version - Write-Log "Re-run WAU" + Write-Log "Re-run WAU" Start-Process powershell -ArgumentList "-ExecutionPolicy Bypass -Command `"$WorkingDir\winget-upgrade`"" exit }