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.
This commit is contained in:
retoor 2024-12-03 20:58:21 +00:00
parent f08844193b
commit 05b70cf94e

View File

@ -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)