Tags: variantdev/mod
Tags
Check HTTP status code in githubreleaseasset getFile before writing t… …o disk The getFile function downloads a GitHub release asset to a local file. It was not checking the HTTP status code before copying the response body to disk, so a non-2xx response (404 for missing asset, 401 for auth failure) would silently write the JSON error body as the file content. The sibling functions getReleaseByTag and getAssetsByReleaseID in the same file already had proper status checks, making this an inconsistency. The fix adds a status code check consistent with the other functions in the file. It also replaces log.Fatal(err) with return err for the request construction error, since log.Fatal calls os.Exit(1) which bypasses all deferred cleanup and error handling up the call stack. An alternative was reading the error response body and including it in the error message, but for a binary asset download endpoint the error body format varies, so a status code and URL is sufficient and consistent with the pattern used by the other functions. Co-Authored-By: Claude Opus 4.6 <[email protected]>
feat: Download release asset from public and private GitHub repositor… …ies by tag and asset names This enhances 7c5edde with a custom go-getter protocol implementation "githubdownload". See the updated README for more information and the usage.
PreviousNext