Use flask send_file to return DMN file

This commit is contained in:
mike cullerton 2021-09-07 12:09:30 -04:00
parent 93e8015ddd
commit a3b3df1bbb
1 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import io
from datetime import datetime
from typing import List
import connexion
@ -176,4 +177,10 @@ def delete_file(file_id):
def dmn_from_ss():
file = connexion.request.files['file']
result = FileService.dmn_from_spreadsheet(file)
return result
return send_file(
io.BytesIO(result),
attachment_filename='temp_dmn.dmn',
mimetype='text/xml',
cache_timeout=-1, # Don't cache these files on the browser.
last_modified=datetime.now()
)