Fix Windows release upload: URL-encode filenames with spaces
Some checks failed
Build Linux / Build sidecar (Linux) (push) Successful in 5m17s
Build Linux / Release (Linux) (push) Has been cancelled
Build macOS / Build app (macOS) (push) Has been cancelled
Build macOS / Release (macOS) (push) Has been cancelled
Build macOS / Build sidecar (macOS) (push) Has been cancelled
Build Linux / Build app (Linux) (push) Has been cancelled
Build Windows / Build app (Windows) (push) Has been cancelled
Build Windows / Release (Windows) (push) Has been cancelled
Build Windows / Build sidecar (Windows) (push) Has been cancelled

Use [System.Uri]::EscapeDataString for proper encoding of filenames
containing spaces in the Gitea API URL. Add size logging and error handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-21 05:54:59 -07:00
parent a3c39a2069
commit 50baa7284e

View File

@@ -140,7 +140,9 @@ jobs:
# Upload artifacts # Upload artifacts
Get-ChildItem -Path artifacts -Recurse -Include *.msi,*.exe | ForEach-Object { Get-ChildItem -Path artifacts -Recurse -Include *.msi,*.exe | ForEach-Object {
$filename = $_.Name $filename = $_.Name
Write-Host "Uploading ${filename}..." $encodedName = [System.Uri]::EscapeDataString($filename)
$size = [math]::Round($_.Length / 1MB, 1)
Write-Host "Uploading ${filename} (${size} MB)..."
# Delete existing asset with same name # Delete existing asset with same name
try { try {
@@ -152,7 +154,12 @@ jobs:
} catch {} } catch {}
# Upload # Upload
Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets?name=${filename}" ` try {
Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets?name=${encodedName}" `
-Method Post -Headers $Headers -ContentType "application/octet-stream" ` -Method Post -Headers $Headers -ContentType "application/octet-stream" `
-InFile $_.FullName -InFile $_.FullName
Write-Host "Upload successful: ${filename}"
} catch {
Write-Host "WARNING: Upload failed for ${filename}: $_"
}
} }