bug fix in webui export name and mimetype

This commit is contained in:
Ali Razmjoo 2021-10-01 18:50:00 +02:00
parent 4115a27e25
commit 5a69fb4be1
2 changed files with 7 additions and 3 deletions

View File

@ -104,6 +104,7 @@ def mime_types():
".tiff": "image/tiff",
".ts": "application/typescript",
".ttf": "font/ttf",
".txt": "text/plain",
".vsd": "application/vnd.visio",
".wav": "audio/x-wav",
".weba": "audio/webm",

View File

@ -348,11 +348,14 @@ def get_result_content():
filename, file_content = get_scan_result(scan_id)
return Response(
file_content,
mimetype=mime_types().get(filename.split('.')[-1]),
mimetype=mime_types().get(
os.path.splitext(filename)[1],
"text/plain"
),
headers={
'Content-Disposition': 'attachment;filename=' + filename
'Content-Disposition': 'attachment;filename=' + filename.split('/')[-1]
}
) if file_content not in [404, 500] else filename, content
)
@app.route("/results/get_json", methods=["GET"])