From 05b70cf94e853a302c771659ab31e036100cb731 Mon Sep 17 00:00:00 2001 From: retoor Date: Tue, 3 Dec 2024 20:58:21 +0000 Subject: [PATCH] fix: correct thumbnail path resolution to use app.upload_path instead of safe_path parent The thumbnail path was incorrectly derived from the safe_path parent directory, causing thumbnails to be stored relative to the file location rather than the configured upload root. This change ensures thumbnails are consistently placed under the application's upload_path/.thumbnail/ directory, fixing path resolution for files in nested subdirectories. --- src/rupload/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rupload/app.py b/src/rupload/app.py index 056206f..b66d726 100644 --- a/src/rupload/app.py +++ b/src/rupload/app.py @@ -281,7 +281,7 @@ async def handle_thumbnail(request: web.Request): except ValueError: return web.Response(status=404, text="File not found.") - thumbnail_path = pathlib.Path(safe_path).parent.joinpath(".thumbnail").joinpath(safe_path.name) + thumbnail_path = pathlib.Path(app.upload_path).joinpath(".thumbnail").joinpath(safe_path.name) if not thumbnail_path.parent.exists(): thumbnail_path.parent.mkdir(exist_ok=True,parents=False)