diff --git a/site/app.py b/site/app.py index d70c0ea..07ab789 100644 --- a/site/app.py +++ b/site/app.py @@ -20,7 +20,7 @@ if _sys_path_root not in sys.path: sys.path.insert(0, _sys_path_root) # Версия приложения (меняется при изменениях) -VERSION = "0.0.28" +VERSION = "0.0.29" def create_app(): diff --git a/site/templates/index.html b/site/templates/index.html index cabefed..8240bdb 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -308,11 +308,15 @@ async function uploadFiles() { function downloadZip() { if (!currentSid) return; fetch('/api/download/' + currentSid) - .then(r => r.blob()) - .then(blob => { + .then(r => { + const disp = r.headers.get('Content-Disposition'); + const m = disp && disp.match(/filename="?(.+?)"?$/); + return Promise.all([r.blob(), m ? m[1] : 'drhider.zip']); + }) + .then(([blob, fname]) => { const a = document.createElement('a'); a.href = URL.createObjectURL(blob); - a.download = 'drhider.zip'; + a.download = fname; document.body.appendChild(a); a.click(); document.body.removeChild(a); @@ -323,11 +327,15 @@ function downloadZip() { function downloadCsv() { if (!currentSid) return; fetch('/api/csv/' + currentSid) - .then(r => r.blob()) - .then(blob => { + .then(r => { + const disp = r.headers.get('Content-Disposition'); + const m = disp && disp.match(/filename="?(.+?)"?$/); + return Promise.all([r.blob(), m ? m[1] : 'mapping.csv']); + }) + .then(([blob, fname]) => { const a = document.createElement('a'); a.href = URL.createObjectURL(blob); - a.download = 'mapping.csv'; + a.download = fname; document.body.appendChild(a); a.click(); document.body.removeChild(a);