Python Firefox不保存扩展名为的文件
我的Django应用程序中有一个视图,它创建一个XLSX文件并将其返回给用户下载:Python Firefox不保存扩展名为的文件,python,django,Python,Django,我的Django应用程序中有一个视图,它创建一个XLSX文件并将其返回给用户下载: # Creates the response response = HttpResponse(output.read(), content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") response['Content-Disposition'] = 'a
# Creates the response
response = HttpResponse(output.read(),
content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
response['Content-Disposition'] = 'attachment; filename="{}".xlsx'.format(tournament.name)
当我尝试在Chrome中下载该文件时,它工作得非常好:文件名为“blabla.xlsx”
但是在Firefox中,它是以文件名“blabla”(无扩展名)下载的
您是否遇到过此问题?尝试替换
”附件;filename=“{}”.xlsx
-->”附件;filename=“{}.xlsx”
谢谢,它纠正了问题。