From e567f1faa179def58e8988810b367f375b8b2bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E6=99=BA=E8=B6=850668000959?= Date: Sun, 14 Jun 2026 23:46:13 +0800 Subject: [PATCH] fix(tts): handle io.ReadAll error in error response path --- pkg/audio/tts/openai_tts.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/audio/tts/openai_tts.go b/pkg/audio/tts/openai_tts.go index baa1a961..82993a19 100644 --- a/pkg/audio/tts/openai_tts.go +++ b/pkg/audio/tts/openai_tts.go @@ -196,7 +196,10 @@ func (t *OpenAITTSProvider) doSpeechRequest( if resp.StatusCode != http.StatusOK { defer resp.Body.Close() - body, _ := io.ReadAll(resp.Body) + body, readErr := io.ReadAll(resp.Body) + if readErr != nil { + body = []byte(fmt.Sprintf("(failed to read error body: %v)", readErr)) + } return nil, &openAITTSAPIError{ statusCode: resp.StatusCode, body: string(body),