@@ -470,6 +470,49 @@ function Invoke-SecureWebRequest {
470470 }
471471}
472472
473+ # Builds a compact display string for download messages without exposing the full URL.
474+ function Get-DownloadDescriptor {
475+ [CmdletBinding ()]
476+ [OutputType ([string ])]
477+ param (
478+ [Parameter (Mandatory = $true )]
479+ [string ]$Uri
480+ )
481+
482+ try {
483+ $downloadUri = [System.Uri ]$Uri
484+ $fileName = [System.IO.Path ]::GetFileName($downloadUri.AbsolutePath )
485+ $trimmedPath = $downloadUri.AbsolutePath.Trim (" /" )
486+ $source = $downloadUri.Host
487+
488+ if ($trimmedPath -match " ^dotnet/[^/]+/aspire/(?<source>.+)/(?<file>[^/]+)$" ) {
489+ $source = $Matches [" source" ]
490+ $fileName = $Matches [" file" ]
491+ }
492+ elseif ($trimmedPath -match " ^public(?:-checksums)?/aspire/+(?<version>[^/]+)/(?<file>[^/]+)$" ) {
493+ $source = " version/$ ( $Matches [" version" ]) "
494+ $fileName = $Matches [" file" ]
495+ }
496+ elseif ($trimmedPath -match " ^(?<source>.+)/(?<file>[^/]+)$" ) {
497+ $source = $Matches [" source" ]
498+ $fileName = $Matches [" file" ]
499+ }
500+
501+ if ([string ]::IsNullOrWhiteSpace($fileName )) {
502+ return $Uri
503+ }
504+
505+ if ([string ]::IsNullOrWhiteSpace($source )) {
506+ return $fileName
507+ }
508+
509+ return " $fileName from '$source '"
510+ }
511+ catch {
512+ return $Uri
513+ }
514+ }
515+
473516# Enhanced file download wrapper with validation
474517function Invoke-FileDownload {
475518 [CmdletBinding ()]
@@ -919,11 +962,12 @@ function Get-AspireExtension {
919962 Write-Message " Downloading Aspire VS Code extension" - Level Info
920963
921964 $extensionUrl = Get-AspireExtensionUrl - Version $Version - Quality $Quality
965+ $extensionDescriptor = Get-DownloadDescriptor - Uri $extensionUrl
922966 $extensionArchive = Join-Path $TempDir $Script :ExtensionArtifactName
923967
924968 try {
925- if ($PSCmdlet.ShouldProcess ($extensionArchive , " Download extension from $extensionUrl " )) {
926- Write-Message " Downloading from: $extensionUrl " - Level Info
969+ if ($PSCmdlet.ShouldProcess ($extensionArchive , " Download extension ( $extensionDescriptor ) " )) {
970+ Write-Message " Downloading $extensionDescriptor " - Level Info
927971 Invoke-FileDownload - Uri $extensionUrl - OutputPath $extensionArchive - TimeoutSec $Script :ArchiveDownloadTimeoutSec
928972 Write-Message " Successfully downloaded extension archive" - Level Verbose
929973 }
@@ -1144,17 +1188,19 @@ function Install-AspireCli {
11441188 $runtimeIdentifier = " $targetOS -$targetArch "
11451189 $extension = if ($targetOS -eq " win" ) { " zip" } else { " tar.gz" }
11461190 $urls = Get-AspireCliUrl - Version $Version - Quality $Quality - RuntimeIdentifier $runtimeIdentifier - Extension $extension
1191+ $archiveDescriptor = Get-DownloadDescriptor - Uri $urls.ArchiveUrl
1192+ $checksumDescriptor = Get-DownloadDescriptor - Uri $urls.ChecksumUrl
11471193
11481194 $archivePath = Join-Path $tempDir $urls.ArchiveFilename
11491195 $checksumPath = Join-Path $tempDir $urls.ChecksumFilename
11501196
1151- if ($PSCmdlet.ShouldProcess ($urls .ArchiveUrl , " Download CLI archive" )) {
1197+ if ($PSCmdlet.ShouldProcess ($archivePath , " Download CLI archive ( $archiveDescriptor ) " )) {
11521198 # Download the Aspire CLI archive
1153- Write-Message " Downloading from: $ ( $urls .ArchiveUrl ) " - Level Info
1199+ Write-Message " Downloading $archiveDescriptor " - Level Info
11541200 Invoke-FileDownload - Uri $urls.ArchiveUrl - TimeoutSec $Script :ArchiveDownloadTimeoutSec - OutputPath $archivePath
11551201 }
11561202
1157- if ($PSCmdlet.ShouldProcess ($urls .ChecksumUrl , " Download CLI archive checksum" )) {
1203+ if ($PSCmdlet.ShouldProcess ($checksumPath , " Download CLI archive checksum ( $checksumDescriptor ) " )) {
11581204 # Download and test the checksum
11591205 Invoke-FileDownload - Uri $urls.ChecksumUrl - TimeoutSec $Script :ChecksumDownloadTimeoutSec - OutputPath $checksumPath
11601206 Test-FileChecksum - ArchiveFile $archivePath - ChecksumFile $checksumPath
0 commit comments