From a7305d14dbf8aa07516a8f8ba0c89ea64249a295 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Mon, 11 Jan 2021 15:21:10 +0100
Subject: [PATCH] =?UTF-8?q?Jobs:=20D=C3=A1vka=20se=20stahuje=20s=20Content?=
 =?UTF-8?q?-Disposition:=20attachment=20a=20jm=C3=A9nem?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 mo/web/util.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mo/web/util.py b/mo/web/util.py
index 9aeeabbf..1ef7d16a 100644
--- a/mo/web/util.py
+++ b/mo/web/util.py
@@ -85,7 +85,10 @@ def send_job_result(job: db.Job) -> Response:
         type = 'application/binary'
 
     if os.path.isfile(file):
-        return send_file(file, mimetype=type)
+        return send_file(file,
+                         mimetype=type,
+                         as_attachment=True,
+                         attachment_filename=job.out_file)
     else:
         logger.error(f'Soubor {file} je výsledkem jobu, ale ve FS neexistuje')
         raise werkzeug.exceptions.NotFound()
-- 
GitLab