@@ -130,19 +130,27 @@ function Start-ContainerUpdateCheck {
130130 $authHeader = @ { Authorization = " Bearer $ ( $tokenResp.token ) " }
131131 $manifestAccept = ' application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json'
132132
133+ # PS7's Invoke-WebRequest returns .Content as byte[] when the response lacks a charset
134+ # (GHCR manifest media types omit it), so piping straight to ConvertFrom-Json yields
135+ # an int array — leaving RemoteVersion null and UpdateAvailable always false. Decode bytes first.
136+ function ConvertFrom-RawJson ($Content ) {
137+ if ($Content -is [byte []]) { $Content = [System.Text.Encoding ]::UTF8.GetString($Content ) }
138+ return $Content | ConvertFrom-Json
139+ }
140+
133141 # GET the channel tag's manifest — extract digest + version label set by CI
134142 # (org.opencontainers.image.version mirrors $env:APP_VERSION in the running container).
135143 $manifestHeaders = $authHeader + @ { Accept = $manifestAccept }
136144 $resp = Invoke-WebRequest - Uri " https://ghcr.io/v2/$imagePath /manifests/$CheckTag " - Method GET - Headers $manifestHeaders - ErrorAction Stop
137145 $RemoteDigest = $resp.Headers [' Docker-Content-Digest' ]
138146 if ($RemoteDigest -is [array ]) { $RemoteDigest = $RemoteDigest [0 ] }
139- $manifest = $resp.Content | ConvertFrom-Json
147+ $manifest = ConvertFrom-RawJson $resp.Content
140148
141149 if ($manifest.manifests ) {
142150 $child = $manifest.manifests | Where-Object { $_.platform.architecture -eq ' amd64' -and $_.platform.os -eq ' linux' } | Select-Object - First 1
143151 if (-not $child ) { $child = $manifest.manifests | Select-Object - First 1 }
144152 $childResp = Invoke-WebRequest - Uri " https://ghcr.io/v2/$imagePath /manifests/$ ( $child.digest ) " - Method GET - Headers $manifestHeaders - ErrorAction Stop
145- $manifest = $childResp.Content | ConvertFrom-Json
153+ $manifest = ConvertFrom-RawJson $childResp.Content
146154 }
147155
148156 $RemoteVersion = $manifest.annotations .' org.opencontainers.image.version'
0 commit comments