From 410d4452d1faaa0d24f9e9e56898b37147a84a81 Mon Sep 17 00:00:00 2001 From: "Gao, Ruiyuan" <905370712@qq.com> Date: Wed, 25 Sep 2024 23:56:33 +0800 Subject: [PATCH] drop request.url.path (#204) --- xiaomusic/httpserver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xiaomusic/httpserver.py b/xiaomusic/httpserver.py index d83c831..6b8acf3 100644 --- a/xiaomusic/httpserver.py +++ b/xiaomusic/httpserver.py @@ -419,7 +419,7 @@ range_pattern = re.compile(r"bytes=(\d+)-(\d*)") @app.get("/music/{file_path:path}") async def music_file(request: Request, file_path: str, key: str = "", code: str = ""): - if not access_key_verification(request.url.path, key, code): + if not access_key_verification(f"/music/{file_path}", key, code): raise HTTPException(status_code=404, detail="File not found") absolute_path = os.path.abspath(config.music_path) @@ -469,7 +469,7 @@ async def music_options(): @app.get("/picture/{file_path:path}") async def get_picture(request: Request, file_path: str, key: str = "", code: str = ""): - if not access_key_verification(request.url.path, key, code): + if not access_key_verification(f"/picture/{file_path}", key, code): raise HTTPException(status_code=404, detail="File not found") absolute_path = os.path.abspath(config.picture_cache_path)