static: use Path.cwd

This commit is contained in:
Luna Mendes 2018-11-19 01:45:35 -03:00
parent 2ff7f796fc
commit f2e3cdd9ff
1 changed files with 5 additions and 1 deletions

View File

@ -6,4 +6,8 @@ bp = Blueprint('static', __name__)
@bp.route('/<path:path>')
async def static_pages(path):
return app.send_static_file(str(Path(f'./static/{path}')))
if '..' in path:
return 'no', 404
static_path = Path.cwd() / Path('static') / path
return await app.send_static_file(str(static_path))