diff --git a/Resources/views/Export/download.html.twig b/Resources/views/Export/download.html.twig index c517c37e8..d1f670d74 100644 --- a/Resources/views/Export/download.html.twig +++ b/Resources/views/Export/download.html.twig @@ -25,8 +25,7 @@ window.addEventListener("DOMContentLoaded", function(e) { var url = "{{ path('chill_main_export_generate', { 'alias' : alias } ) }}", query = window.location.search, - container = document.querySelector("#download_container"), - header_content_type + container = document.querySelector("#download_container") ; window.fetch(url+query, { credentials: 'same-origin' }) @@ -34,14 +33,14 @@ window.addEventListener("DOMContentLoaded", function(e) { if (!response.ok) { throw Error(response.statusText); } - header_content_type = response.headers.get("Content-Type"); + return response.blob(); }).then(function(blob) { var content = URL.createObjectURL(blob), link = document.createElement("a"), suffix_file; - switch (header_content_type) { + switch (blob.type) { case 'application/vnd.oasis.opendocument.spreadsheet': suffix_file = '.ods'; break;