diff --git a/sql/data_dictionary.py b/sql/data_dictionary.py index 05e20622bc..942023ac94 100644 --- a/sql/data_dictionary.py +++ b/sql/data_dictionary.py @@ -90,9 +90,11 @@ def table_info(request): ) -def get_export_full_path(base_dir:str, instance_name: str, db_name: str) -> str: +def get_export_full_path(base_dir: str, instance_name: str, db_name: str) -> str: """validate if the instance_name and db_name provided is secure""" - fullpath = os.path.normpath(os.path.join(base_dir, f"{instance_name}_{db_name}.html")) + fullpath = os.path.normpath( + os.path.join(base_dir, f"{instance_name}_{db_name}.html") + ) if not fullpath.startswith(base_dir): return "" return fullpath @@ -145,9 +147,7 @@ def export(request): fullpath = get_export_full_path(path, instance_name, db) if not fullpath: return JsonResponse({"status": 1, "msg": "实例名或db名不合法", "data": []}) - response = FileResponse( - open(fullpath, "rb") - ) + response = FileResponse(open(fullpath, "rb")) response["Content-Type"] = "application/octet-stream" response[ "Content-Disposition"