parent
58662fa7a8
commit
640a42d308
@ -276,12 +276,8 @@ async def handle_thumbnail(request: web.Request):
|
|||||||
if not safe_path.is_file():
|
if not safe_path.is_file():
|
||||||
return web.Response(status=400, text="Invalid file type.")
|
return web.Response(status=400, text="Invalid file type.")
|
||||||
|
|
||||||
try:
|
|
||||||
pathlib.Path(safe_path).relative_to(request.app.upload_path)
|
|
||||||
except ValueError:
|
|
||||||
return web.Response(status=404, text="File not found.")
|
|
||||||
|
|
||||||
thumbnail_path = pathlib.Path(request.app.upload_path).joinpath(".thumbnail").joinpath(safe_path.name)
|
thumbnail_path = pathlib.Path(request.app.upload_folder).joinpath(".thumbnail").joinpath(safe_path.name)
|
||||||
if not thumbnail_path.parent.exists():
|
if not thumbnail_path.parent.exists():
|
||||||
thumbnail_path.parent.mkdir(exist_ok=True,parents=False)
|
thumbnail_path.parent.mkdir(exist_ok=True,parents=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user