mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-09-29 11:22:25 +02:00
Merge pull request #346 from jiawenlai1109/fix/audio-temp-leak-on-save-error
fix(audio_generator): clean up temp file when gTTS save() fails
This commit is contained in:
@@ -88,9 +88,8 @@ def generate_audio_cross_platform(prompt: str) -> bytes:
|
||||
|
||||
tts = gTTS(text=prompt, lang="en")
|
||||
temp_mp3_path = f"temp_audio_{uuid.uuid4().hex}.mp3"
|
||||
tts.save(temp_mp3_path)
|
||||
|
||||
try:
|
||||
tts.save(temp_mp3_path)
|
||||
with open(temp_mp3_path, "rb") as f:
|
||||
audio_bytes = f.read()
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user