fix: clean failed document uploads and surface filesystem errors
This commit is contained in:
+2
-6
@@ -969,17 +969,13 @@ const server = http.createServer(async (req, res) => {
|
||||
try { ofisMetni = arsivMetni(String(body.ad), buf); } catch { /* metin çıkmazsa devam */ }
|
||||
if (!ikn && body.otoIkn && ofisMetni) ikn = iknCikar(ofisMetni);
|
||||
}
|
||||
const dosyaAdi = `${Date.now()}-${crypto.randomUUID()}`;
|
||||
fs.writeFileSync(path.join(store.BELGE_DIR, dosyaAdi), buf);
|
||||
const id = store.addDocument(user.email, {
|
||||
const id = store.saveDocumentFile(user.email, {
|
||||
ad: String(body.ad).slice(0, 200),
|
||||
kategori: metadata.kategori || null,
|
||||
boyut: buf.length, // GERÇEK bayt — rastgele değil
|
||||
mime: body.mime || null,
|
||||
dosya: dosyaAdi,
|
||||
sonKullanma: metadata.sonKullanma || null,
|
||||
ikn, // ihaleye bağlı belge
|
||||
});
|
||||
}, buf);
|
||||
// Yükleme anında otomatik kalem çıkarımı — AI kullanmaz, kullanıcıdan
|
||||
// tıklama beklemez. PDF'ler tarayıcıda çözüldüğü için istemci
|
||||
// metni /api/kalem/cikar'a gönderir.
|
||||
|
||||
Reference in New Issue
Block a user