fix: download ZIP/CSV через fetch+Blob вместо window.location — не сбрасывает страницу
Deploy drhider / validate (push) Waiting to run

This commit is contained in:
2026-07-15 14:57:03 +04:00
parent 68fada075e
commit e66dff23b8
2 changed files with 23 additions and 3 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
sys.path.insert(0, _sys_path_root)
# Версия приложения (меняется при изменениях)
VERSION = "0.0.26"
VERSION = "0.0.27"
def create_app():
+22 -2
View File
@@ -295,12 +295,32 @@ async function uploadFiles() {
function downloadZip() {
if (!currentSid) return;
window.location = '/api/download/' + currentSid;
fetch('/api/download/' + currentSid)
.then(r => r.blob())
.then(blob => {
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'drhider.zip';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(a.href);
});
}
function downloadCsv() {
if (!currentSid) return;
window.location = '/api/csv/' + currentSid;
fetch('/api/csv/' + currentSid)
.then(r => r.blob())
.then(blob => {
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'mapping.csv';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(a.href);
});
}
</script>
<div id="helpModal" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.5);z-index:999;justify-content:center;align-items:center" onclick="this.style.display='none'">