Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoQuote committed Aug 14, 2023
1 parent d9fa8bb commit 5d165dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sql/data_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 5d165dc

Please sign in to comment.