Skip to content

Commit 01f4965

Browse files
Potential fix for code scanning alert no. 31: Uncontrolled data used in path expression
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 693ad77 commit 01f4965

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

create_demo.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import webbrowser
66
import logging
77
import re
8+
from werkzeug.utils import secure_filename
89
import tempfile
910
import shutil
1011
import types
@@ -555,8 +556,8 @@ def create_html_demo_whisperx(script_filepath: str, audio_filepath: str, title:
555556
final_html_body = reconstruct_html_with_timing(segments)
556557

557558
# --- 7. Sauvegarder ---
558-
safe_filename = re.sub(r'[^\w\s-]', '', title).strip().lower()
559-
safe_filename = re.sub(r'[-\s]+', '_', safe_filename)
559+
safe_filename = secure_filename(title)
560+
safe_filename = os.path.splitext(safe_filename)[0] # Remove extension if present
560561
if not safe_filename:
561562
safe_filename = "podcast_demo"
562563

0 commit comments

Comments
 (0)