fix: missing parameter (#93)

This commit is contained in:
Hayden
2025-01-13 15:58:11 +08:00
committed by GitHub
parent 4132b2d8c4
commit c2406a1fd1
5 changed files with 19 additions and 21 deletions

View File

@@ -131,11 +131,11 @@ def resolve_model_base_paths(request):
return model_base_paths
def get_full_path(model_type: str, path_index: int, filename: str):
def get_full_path(model_type: str, path_index: int, filename: str, request):
"""
Get the absolute path in the model type through string concatenation.
"""
folders = resolve_model_base_paths().get(model_type, [])
folders = resolve_model_base_paths(request).get(model_type, [])
if not path_index < len(folders):
raise RuntimeError(f"PathIndex {path_index} is not in {model_type}")
base_path = folders[path_index]
@@ -143,11 +143,11 @@ def get_full_path(model_type: str, path_index: int, filename: str):
return full_path
def get_valid_full_path(model_type: str, path_index: int, filename: str):
def get_valid_full_path(model_type: str, path_index: int, filename: str, request):
"""
Like get_full_path but it will check whether the file is valid.
"""
folders = resolve_model_base_paths().get(model_type, [])
folders = resolve_model_base_paths(request).get(model_type, [])
if not path_index < len(folders):
raise RuntimeError(f"PathIndex {path_index} is not in {model_type}")
base_path = folders[path_index]