Commit 4681552d by 周田

mod

parent 170eb867
...@@ -46,17 +46,14 @@ def download(request): ...@@ -46,17 +46,14 @@ def download(request):
file_path = os.path.join(settings.BASE_DIR, 'protocol_raw_files', protocol_name, version) file_path = os.path.join(settings.BASE_DIR, 'protocol_raw_files', protocol_name, version)
for root, _, files in os.walk(file_path): for root, _, files in os.walk(file_path):
for file in files: file_path = os.path.join(root, files[1])
# if file != 'xdc.sqlite': # 适配中文
# continue file_name = urllib.parse.quote(os.path.basename(file_path))
file_path = os.path.join(root, files[3])
# 适配中文 response = FileResponse(open(file_path, 'rb'))
file_name = urllib.parse.quote(os.path.basename(file_path)) response['Content-Disposition'] = 'inline; filename=' + file_name
response['Content-Type'] = 'multipart/form-data'
response = FileResponse(open(file_path, 'rb')) response['filename'] = file_name
response['Content-Disposition'] = 'inline; filename=' + file_name return response
response['Content-Type'] = 'multipart/form-data'
response['filename'] = file_name
return response
return Response(status=status.HTTP_200_OK) return Response(status=status.HTTP_200_OK)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment