优化whitelist.py,只处理点分路径

This commit is contained in:
jingrow 2025-11-05 00:15:43 +08:00
parent 08e4bd5653
commit 21746c9a1e

View File

@ -113,7 +113,12 @@ async def _process_whitelist_call(request: Request, full_module_path: str):
async def handle_request(request: Request, module_path: str): async def handle_request(request: Request, module_path: str):
""" """
直接传入完整点分路径 '<package.module.function>' 直接传入完整点分路径 '<package.module.function>'
只处理包含点分路径的模块路径
""" """
# 验证模块路径格式:必须包含至少一个点(如 package.module.function
if '.' not in module_path:
raise HTTPException(status_code=404, detail="Not Found")
return await _process_whitelist_call(request, module_path) return await _process_whitelist_call(request, module_path)
def import_module(module_path: str): def import_module(module_path: str):