Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Use last returned value of au_GetLatest instead of everything #28

Closed
majkinetor opened this issue Sep 20, 2016 · 0 comments
Closed

Use last returned value of au_GetLatest instead of everything #28

majkinetor opened this issue Sep 20, 2016 · 0 comments

Comments

@majkinetor
Copy link
Owner

People may accidentally return something else and it stops working. Example:

microsoftazurestorageexplorer

au_GetLatest failed
au_GetLatest doesn't return a HashTable result but System.Object[]

With this updater:

function global:au_GetLatest {
    $homepage_content = Invoke-WebRequest -UseBasicParsing -Uri $homepage

    # Get Version
    $homepage_content -match '(Version \d+.\d+.\d+)'     #<--------- OFFENDING LINE, RETURNS A VALUE
    $version = $matches[1] -replace "Version ", ""

    $Latest = @{ URL = $url; Version = $version }
    return $Latest
}

For this reason just take a last value returned and compalin if its not a [HashTable]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant