Skip to content

Commit b418cc5

Browse files
authored
Merge pull request #170 from fscpscollaborative/develop
Release merge
2 parents bb461ee + 08fb9c2 commit b418cc5

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

fscps.tools/functions/get-fscpssystemupdatepackage.ps1

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,15 @@ function Get-FSCPSSystemUpdatePackage {
9595
} elseif ($UpdateType -eq [UpdateType]::ProactiveQualityUpdate) {
9696
$destinationFileName = "Proactive Quality Update - $D365FSCVersion"
9797
}
98-
98+
try {
99+
$blobFile = Get-FSCPSAzureStorageFile -Name "*$destinationFileName*"
100+
}
101+
catch {
102+
Write-PSFMessage -Level Error -Message "File $destinationFileName is not found at $($azureDetails.Container)"
103+
throw
104+
}
99105
# Combine the OutputPath with the destination file name
100-
$destinationFilePath = Join-Path -Path $OutputPath -ChildPath $destinationFileName
106+
$destinationFilePath = Join-Path -Path $OutputPath -ChildPath $blobFile.Name
101107
}
102108

103109
process {
@@ -107,17 +113,10 @@ function Get-FSCPSSystemUpdatePackage {
107113
try {
108114

109115
$download = (-not(Test-Path $destinationFilePath))
116+
110117
if(!$download)
111118
{
112-
Write-PSFMessage -Level Host -Message $destinationFileName
113-
try {
114-
$blobFile = Get-FSCPSAzureStorageFile -Name "*$destinationFileName*"
115-
}
116-
catch {
117-
Write-PSFMessage -Level Error -Message "File $destinationFileName is not found at $($azureDetails.Container)"
118-
throw
119-
}
120-
119+
Write-PSFMessage -Level Host -Message $blobFile.Name
121120
$blobSize = $blobFile.Length
122121
$localSize = (Get-Item $destinationFilePath).length
123122
Write-PSFMessage -Level Verbose -Message "BlobSize is: $blobSize"
@@ -132,7 +131,7 @@ function Get-FSCPSSystemUpdatePackage {
132131

133132
if($download)
134133
{
135-
Invoke-FSCPSAzureStorageDownload -FileName $destinationFileName -Path $OutputPath -Force:$Force
134+
Invoke-FSCPSAzureStorageDownload -FileName $blobFile.Name -Path $OutputPath -Force:$Force
136135
if (-not [System.IO.Path]::GetExtension($destinationFilePath) -ne ".zip") {
137136
# Rename the file to have a .zip extension
138137
$newFilePath = "$destinationFilePath.zip".Replace(" ", "")

0 commit comments

Comments
 (0)