v1.0.123: fix ZIP — cgi.FieldStorage for multipart, CORS on all responses, revert Lucee unzip
This commit is contained in:
@@ -75,7 +75,7 @@
|
||||
<body>
|
||||
<div class="topbar">
|
||||
<img src="/nubes-logo.svg" alt="Nubes">
|
||||
<span class="title">Сверка договоров — LLM AI-driven Event Sourcing <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.122 — Lucee</span></span>
|
||||
<span class="title">Сверка договоров — LLM AI-driven Event Sourcing <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.123 — Lucee</span></span>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
@@ -176,6 +176,7 @@ lucide.createIcons();
|
||||
|
||||
var UPLOAD_URL = 'https://contracts.kube5s.ru/lucee/upload.cfm';
|
||||
var CONVERT_URL = 'https://contracts.kube5s.ru/convert-doc';
|
||||
var UNZIP_URL = 'https://contracts.kube5s.ru/unzip-upload';
|
||||
var SITE_URL = ''; // same origin for api calls
|
||||
|
||||
var fileInput = document.getElementById('fileInput');
|
||||
@@ -258,20 +259,9 @@ fileInput.addEventListener('change', async function() {
|
||||
renderTable();
|
||||
|
||||
try {
|
||||
// Читаем ZIP через FileReader → base64
|
||||
var zipData = await new Promise(function(resolve, reject) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() { resolve(reader.result); };
|
||||
reader.onerror = function() { reject(new Error('FileReader failed')); };
|
||||
reader.readAsDataURL(f);
|
||||
});
|
||||
var zipB64 = zipData.split(',')[1]; // убрать префикс data:application/zip;base64,
|
||||
|
||||
var zipResp = await fetch('/unzip.cfm', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({filename: f.name, data: zipB64, contract_id: contractId || ''})
|
||||
});
|
||||
var fd = new FormData();
|
||||
fd.append('file', f);
|
||||
var zipResp = await fetch(UNZIP_URL, { method: 'POST', body: fd });
|
||||
var zipData = await zipResp.json();
|
||||
if (!zipData.ok || !zipData.files) throw new Error('unzip failed');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user