From 5d165dcb63a1f676f09fcd66540c42645e12354b Mon Sep 17 00:00:00 2001 From: Leo Q Date: Mon, 14 Aug 2023 13:59:28 +0000 Subject: [PATCH] black --- sql/data_dictionary.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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"