fix: URL-encode asset filename, truncate error body in APIError
CI / test (pull_request) Successful in 14s
CI / review (gpt-4.1, gpt, GPT_REVIEW_TOKEN) (pull_request) Successful in 23s
CI / review (gpt-5, security, SECURITY_REVIEW.md, SECURITY_REVIEW_TOKEN) (pull_request) Successful in 51s
CI / review (gpt-5, sonnet, SONNET_REVIEW_TOKEN) (pull_request) Successful in 1m21s

- URL-encode filename in release upload query param (MINOR)
- Truncate APIError.Body to 200 chars in Error() to avoid leaking
  verbose server responses into logs (NIT)
This commit is contained in:
Rodin
2026-05-02 10:02:03 -07:00
parent bfca28b2b2
commit 2339999d37
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -26,7 +26,11 @@ type APIError struct {
}
func (e *APIError) Error() string {
return fmt.Sprintf("HTTP %d: %s", e.StatusCode, e.Body)
body := e.Body
if len(body) > 200 {
body = body[:200] + "...(truncated)"
}
return fmt.Sprintf("HTTP %d: %s", e.StatusCode, body)
}
// IsNotFound reports whether an error is an API 404 response.