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
+14 -6
View File
@@ -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);