[shutil] used thanks to trunk calling out security implication of the native os cp command via the script.

This commit is contained in:
Ray Smets 2023-11-24 10:09:03 -08:00
parent 5cedbec10f
commit ac703e9ebb
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import base64 import base64
import errno import errno
import os import os
import shutil
import time import time
from dotenv import load_dotenv from dotenv import load_dotenv
@ -63,9 +64,8 @@ def play_audio(text):
# Copy the image analyzed to the same directory as the audio file # Copy the image analyzed to the same directory as the audio file
image_path = os.path.join(os.getcwd(), "./frames/frame.jpg") image_path = os.path.join(os.getcwd(), "./frames/frame.jpg")
new_image_path = os.path.join(dir_path, "image.jpg") new_image_path = os.path.join(dir_path, "image.jpg")
os.system(f"cp {image_path} {new_image_path}") shutil.copy(image_path, new_image_path)
# Play the audio
play(audio) play(audio)