fix: Properly escape URI and improve Load-Config error message

This commit is contained in:
Bobby Abellana (aider) 2025-02-21 10:49:18 -08:00
parent 3a2cb289db
commit 728ce14af4

View File

@ -8,7 +8,7 @@ function Load-Config {
$script:config = Get-Content $configPath -Raw | ConvertFrom-Json $script:config = Get-Content $configPath -Raw | ConvertFrom-Json
return $true return $true
} else { } else {
$script:txtStatus.Text += "Error loading configuration: $($_.Exception.Message)`n" $script:txtStatus.Text += "Error loading configuration: Config file not found`n"
return $false return $false
} }
} }
@ -477,7 +477,7 @@ function Convert-Files {
try { try {
# Get the Drive ID and destination folder # Get the Drive ID and destination folder
$destinationFolder = $script:txtTempLib.Text $destinationFolder = $script:txtTempLib.Text
$uploadUri = "https://graph.microsoft.com/v1.0/drives/$driveId/root:/$destinationFolder/$xlsxFileName:/content" $uploadUri = "https://graph.microsoft.com/v1.0/drives/$driveId/root:/$($destinationFolder)/$($xlsxFileName):/content"
# Read the file content # Read the file content
$fileContent = [System.IO.File]::ReadAllBytes($xlsxPath) $fileContent = [System.IO.File]::ReadAllBytes($xlsxPath)