Fix base64 executable not found on Windows in gh aw update#17720
Fix base64 executable not found on Windows in gh aw update#17720
base64 executable not found on Windows in gh aw update#17720Conversation
…s compatibility Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
base64 executable not found on Windows in gh aw update
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added in 1aafa81. Extracted the decoding logic into a |
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows compatibility issue where gh aw update fails because it shells out to the base64 command-line utility, which is not available on Windows by default. The fix replaces the external base64 command with Go's standard library encoding/base64 package for cross-platform compatibility.
Changes:
- Replaced shell command execution for base64 decoding with Go stdlib implementation
- Added comprehensive unit tests covering various edge cases including GitHub API-style newline wrapping
- Extracted decoding logic into a dedicated
decodeBase64FileContenthelper function
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/cli/download_workflow.go | Replaced exec.Command("base64", "-d") with stdlib base64.StdEncoding.DecodeString() and added decodeBase64FileContent helper that handles GitHub API's 60-character line wrapping |
| pkg/cli/download_workflow_test.go | Added comprehensive unit tests for the new decodeBase64FileContent function covering plain base64, newline-wrapped content, whitespace handling, binary data, and error cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gh aw updatefails on Windows becausedownloadWorkflowContentshells out to thebase64binary (unavailable on Windows) to decode GitHub API responses.Changes
pkg/cli/download_workflow.go: Replaceexec.Command("base64", "-d")with Go's stdlibencoding/base64.StdEncoding.DecodeString(), extracting the logic into adecodeBase64FileContenthelper that strips embedded newlines the GitHub API includes in its base64 payload before decoding.pkg/cli/download_workflow_test.go: Added unit tests fordecodeBase64FileContentcovering plain base64, GitHub API-style newline-wrapped content, leading/trailing whitespace stripping, binary content round-trips, and invalid input error handling.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.