mirror of
https://github.com/pretix/pretix.git
synced 2026-05-20 17:44:02 +00:00
Do not force PDFs to be downloaded (Z#23225892) (#5994)
* Display invoice and tickets inline in browser (Z#23225892) * Use FileResponse filename for AnswerDownload * Use inline for PDF-view in pretix-control editor * use as_attachment for API FileResponses * do not ignore csp even for disposition=inline * use as_attachment for file responses in control * remove unused code * improve code style * Invoice preview inline * do not force download on tickets in backend * do not force download on AnswerDownload * imrpove code style * improve code style * fix missing int str conversion * Apply suggestions from code review Co-authored-by: luelista <mira@teamwiki.de> --------- Co-authored-by: luelista <mira@teamwiki.de>
This commit is contained in:
committed by
GitHub
parent
059ff6c99b
commit
5682d3ed56
@@ -855,9 +855,13 @@ class AnswerDownload(EventViewMixin, View):
|
||||
return Http404()
|
||||
|
||||
ftype, _ = mimetypes.guess_type(answer.file.name)
|
||||
resp = FileResponse(answer.file, content_type=ftype or 'application/binary')
|
||||
resp['Content-Disposition'] = 'attachment; filename="{}-cart-{}"'.format(
|
||||
filename = '{}-cart-{}'.format(
|
||||
self.request.event.slug.upper(),
|
||||
os.path.basename(answer.file.name).split('.', 1)[1]
|
||||
).encode("ascii", "ignore")
|
||||
)
|
||||
resp = FileResponse(
|
||||
answer.file,
|
||||
filename=filename,
|
||||
content_type=ftype or 'application/binary'
|
||||
)
|
||||
return resp
|
||||
|
||||
Reference in New Issue
Block a user