mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-11-27 04:23:25 +01: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:
1 file changed
+1
-2
@@ -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