From 45b3b17ac7ad514b06e7c7b8a02f12448a2e1920 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 12 Oct 2023 13:54:58 -0400 Subject: [PATCH] get absolute uri --- Tools.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Tools.ps1 b/Tools.ps1 index c3f7be0..7cbe4f8 100644 --- a/Tools.ps1 +++ b/Tools.ps1 @@ -187,6 +187,7 @@ Function Download-File { [Parameter(Mandatory=$false,ValueFromPipeline=$false)][string]$File ) If ( !($File) ) { $File = '{0}{1}' -f (Get-TempPath), (Split-Path $URL -Leaf) } + $URL = Get-AbsoluteURI -URL $URL If ( IsURLValid $URL ) { If ( Test-Path $File ) { Write-Output "Deleting existing file: ""${File}""" @@ -787,9 +788,9 @@ Function Test-RegistryProperty { } # Function to format a quantity of bytes into a denomination -Function Beautify-Bytes { +Function Format-ByteQuantity { param( - [int64]$Amount, + [int64]$TotalBytes, [int]$Precision=2, [string]$Units, [switch]$WithUnitLabel @@ -802,8 +803,8 @@ Function Beautify-Bytes { default { $UnitLabel = "bytes" ; $Divisor = 1 } } Switch ( $WithUnitLabel ) { - $true { Return (ZeroPad-Decimal -Amount $([Math]::Round($Amount / $Divisor,$Precision)) -NeededDecimalPlaces $Precision) + "${UnitLabel}" } - $false { Return (ZeroPad-Decimal -Amount $([Math]::Round($Amount / $Divisor,$Precision)) -NeededDecimalPlaces $Precision) } + $true { Return (ZeroPad-Decimal -Amount $([Math]::Round($TotalBytes / $Divisor,$Precision)) -NeededDecimalPlaces $Precision) + "${UnitLabel}" } + $false { Return (ZeroPad-Decimal -Amount $([Math]::Round($TotalBytes / $Divisor,$Precision)) -NeededDecimalPlaces $Precision) } } }