get absolute uri
This commit is contained in:
@@ -187,6 +187,7 @@ Function Download-File {
|
|||||||
[Parameter(Mandatory=$false,ValueFromPipeline=$false)][string]$File
|
[Parameter(Mandatory=$false,ValueFromPipeline=$false)][string]$File
|
||||||
)
|
)
|
||||||
If ( !($File) ) { $File = '{0}{1}' -f (Get-TempPath), (Split-Path $URL -Leaf) }
|
If ( !($File) ) { $File = '{0}{1}' -f (Get-TempPath), (Split-Path $URL -Leaf) }
|
||||||
|
$URL = Get-AbsoluteURI -URL $URL
|
||||||
If ( IsURLValid $URL ) {
|
If ( IsURLValid $URL ) {
|
||||||
If ( Test-Path $File ) {
|
If ( Test-Path $File ) {
|
||||||
Write-Output "Deleting existing file: ""${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 to format a quantity of bytes into a denomination
|
||||||
Function Beautify-Bytes {
|
Function Format-ByteQuantity {
|
||||||
param(
|
param(
|
||||||
[int64]$Amount,
|
[int64]$TotalBytes,
|
||||||
[int]$Precision=2,
|
[int]$Precision=2,
|
||||||
[string]$Units,
|
[string]$Units,
|
||||||
[switch]$WithUnitLabel
|
[switch]$WithUnitLabel
|
||||||
@@ -802,8 +803,8 @@ Function Beautify-Bytes {
|
|||||||
default { $UnitLabel = "bytes" ; $Divisor = 1 }
|
default { $UnitLabel = "bytes" ; $Divisor = 1 }
|
||||||
}
|
}
|
||||||
Switch ( $WithUnitLabel ) {
|
Switch ( $WithUnitLabel ) {
|
||||||
$true { Return (ZeroPad-Decimal -Amount $([Math]::Round($Amount / $Divisor,$Precision)) -NeededDecimalPlaces $Precision) + "${UnitLabel}" }
|
$true { Return (ZeroPad-Decimal -Amount $([Math]::Round($TotalBytes / $Divisor,$Precision)) -NeededDecimalPlaces $Precision) + "${UnitLabel}" }
|
||||||
$false { Return (ZeroPad-Decimal -Amount $([Math]::Round($Amount / $Divisor,$Precision)) -NeededDecimalPlaces $Precision) }
|
$false { Return (ZeroPad-Decimal -Amount $([Math]::Round($TotalBytes / $Divisor,$Precision)) -NeededDecimalPlaces $Precision) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user