Files
c020627 6da81c3e09 fix(dingtalk): clean up outbound media temp files
upload_media() downloads a remote URL into the tmp dir and never
removes it: the success, errcode and exception paths of the upload all
leave the file behind, and nothing sweeps the tmp dir. The voice send
converts the TTS output to a sibling .amr that is never removed either
-- and pydub opens that target before it spawns ffmpeg, so even a
failed conversion leaves a half-written file.

Every sibling sender already cleans up after itself (weixin's
`if downloaded: remove_download(...)`, wecom_bot's temp_files +
finally); dingtalk was the one that did not. The download now lands on
a unique state_dir.tmp_file() name and is removed in a finally around
the upload, and the amr is registered before the conversion so a
failure cleans it too. The TTS source itself is left in place, the way
the siblings leave a local source alone.
2026-10-24 12:05:10 +08:00
..