fix: имя файла из Content-Disposition а не хардкод
Deploy drhider / validate (push) Waiting to run

This commit is contained in:
2026-07-15 15:06:43 +04:00
parent 40372fe03f
commit 5efed1c577
2 changed files with 15 additions and 7 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
sys.path.insert(0, _sys_path_root) sys.path.insert(0, _sys_path_root)
# Версия приложения (меняется при изменениях) # Версия приложения (меняется при изменениях)
VERSION = "0.0.28" VERSION = "0.0.29"
def create_app(): def create_app():
+14 -6
View File
@@ -308,11 +308,15 @@ async function uploadFiles() {
function downloadZip() { function downloadZip() {
if (!currentSid) return; if (!currentSid) return;
fetch('/api/download/' + currentSid) fetch('/api/download/' + currentSid)
.then(r => r.blob()) .then(r => {
.then(blob => { 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'); const a = document.createElement('a');
a.href = URL.createObjectURL(blob); a.href = URL.createObjectURL(blob);
a.download = 'drhider.zip'; a.download = fname;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
document.body.removeChild(a); document.body.removeChild(a);
@@ -323,11 +327,15 @@ function downloadZip() {
function downloadCsv() { function downloadCsv() {
if (!currentSid) return; if (!currentSid) return;
fetch('/api/csv/' + currentSid) fetch('/api/csv/' + currentSid)
.then(r => r.blob()) .then(r => {
.then(blob => { 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'); const a = document.createElement('a');
a.href = URL.createObjectURL(blob); a.href = URL.createObjectURL(blob);
a.download = 'mapping.csv'; a.download = fname;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
document.body.removeChild(a); document.body.removeChild(a);