Skip to content

Commit a780a0b

Browse files
committed
修复中文名附件乱码的bug
1 parent ec8b65f commit a780a0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

blog/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def file_iterator(file_name, chunk_size=512):
197197
file_path = os.path.join(UPLOADPATH, article_id, file_name)
198198
response = FileResponse(file_iterator(file_path))
199199
response['Content-Type'] = 'application/octet-stream'
200-
response['Content-Disposition'] = 'attachment;filename=%s' % file_name
200+
response['Content-Disposition'] = 'attachment;filename=%s' % file_name.encode('utf-8')
201201
return response
202202

203203
class CategoryView(ListView):

0 commit comments

Comments
 (0)