mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-09-29 11:22:25 +02:00
generate_audio_cross_platform() created the temp MP3 via tts.save() one statement *before* the try/finally that was supposed to remove it, so any exception raised by the save itself escaped the cleanup and left temp_audio_<hex>.mp3 in the current working directory. gTTS.save() performs an outbound HTTP request, which is exactly the path that fails offline or behind egress restrictions, and .gitignore does not cover the temp_audio_* pattern - so every such run litters the working tree. Move the save inside the existing try. Success-path behaviour is unchanged, and this now matches how generate_audio_mac_wav() in the same file already guards its two temp paths. Verified on Ubuntu 22.04 / Python 3.14.7, same offline-failing test before and after: leaked temp_audio_*.mp3 count went 1 -> 0, test result unchanged (1 failed, gTTSError: Failed to connect). black --check passes; rest of the module is 1 passed, 1 skipped, 1 pre-existing offline failure.