feat: validate preparation against owned document files

This commit is contained in:
2026-09-06 08:53:41 +03:00
parent 0d332afdb1
commit 953d3b5c1e
7 changed files with 91 additions and 11 deletions
+2 -2
View File
@@ -250,11 +250,11 @@ export function addDocument(email, { ad, kategori, boyut, mime, dosya, sonKullan
}
export function listDocuments(email, { ikn } = {}) {
const alanlar = 'id, ad, kategori, boyut, mime, son_kullanma, ikn, olusturma';
const alanlar = 'id, ad, kategori, boyut, mime, son_kullanma, ikn, olusturma, dosya';
return withDb((db) => (ikn
? db.prepare(`SELECT ${alanlar} FROM belgeler WHERE email=? AND ikn=? ORDER BY olusturma DESC`).all(email, ikn)
: db.prepare(`SELECT ${alanlar} FROM belgeler WHERE email=? ORDER BY olusturma DESC`).all(email)
), []);
).map(({dosya,...record}) => ({...record, erisilebilir: fs.existsSync(path.join(BELGE_DIR,dosya))})), []);
}
export function getDocument(email, id) {