Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion MultimodalQnA/ui/gradio/multimodalqna_ui_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,17 @@ def ingest_with_caption(filepath, text_caption, audio_caption, request: gr.Reque
is_audio_caption = audio_caption is not None
if is_audio_caption:
verified_audio_path = os.path.normpath(audio_caption)
if not verified_audio_path.startswith(tmp_upload_folder):
print("Found malicious audio file path!")
yield (
gr.Textbox(
visible=True,
value="Your uploaded audio file's path is not allowed. Please upload a valid file.",
)
)
return
caption_basename = "{}{}".format(os.path.splitext(basename)[0], os.path.splitext(verified_audio_path)[-1])
caption_file = audio_caption
caption_file = verified_audio_path
else:
caption_basename = "{}.txt".format(os.path.splitext(basename)[0])
caption_file = os.path.join(static_dir, caption_basename)
Expand Down
Loading