From e8ce33edede3960665c44dd6dabe111d69a04b97 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Mon, 10 Aug 2026 01:35:31 -0400 Subject: [PATCH] fix(videos): fix FileNotFoundError crashing convert thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit safe_video_path checks file existence — mp4 output doesn't exist yet. Add _local_path_unchecked() for output paths that don't exist yet. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- modules/app_video.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/app_video.py b/modules/app_video.py index 6c29d85..7b6a3e0 100644 --- a/modules/app_video.py +++ b/modules/app_video.py @@ -46,7 +46,7 @@ def _convert_bg(relative_path): try: source_path = _local_path(relative_path) mp4_relative = os.path.splitext(relative_path)[0] + ".mp4" - mp4_path = _local_path(mp4_relative) + mp4_path = _local_path_unchecked(mp4_relative) if not app_dash.begin_local_video_use(relative_path): return @@ -96,6 +96,15 @@ def _local_path(relative_path): return app_dash.safe_video_path(app_dash.DEFAULT_DESTINATION, relative_path) +def _local_path_unchecked(relative_path): + """Build absolute path without requiring the file to already exist.""" + base = os.path.realpath(app_dash.DEFAULT_DESTINATION) + target = os.path.realpath(os.path.join(base, relative_path)) + if os.path.commonpath([base, target]) != base: + raise ValueError("Path escapes video directory.") + return target + + def _thumbnail_path(relative_path): source_root = os.path.realpath(app_dash.DEFAULT_DESTINATION) source_path = app_dash.safe_video_path(source_root, relative_path)