From d587f31953deb5924904d335dffd19e54139011e Mon Sep 17 00:00:00 2001 From: seb Date: Sun, 18 Oct 2026 14:44:22 +0200 Subject: [PATCH] u --- src/store/articlehistory/record.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/store/articlehistory/record.js b/src/store/articlehistory/record.js index 68b7c5a..604b5a5 100644 --- a/src/store/articlehistory/record.js +++ b/src/store/articlehistory/record.js @@ -112,7 +112,10 @@ export async function recordArticleHistory(runner, { articleId, companyuserId, d let parsedDate = null; if (date != null) { const d = date instanceof Date ? date : new Date(date); - if (!Number.isNaN(d.getTime())) parsedDate = d; + if (Number.isNaN(d.getTime())) { + throw new Error(`Invalid date provided for article history: ${date}`); + } + parsedDate = d; } const insertSql = runner?.dialect === 'sqlite3' ? SQLITE_INSERT : MSSQL_INSERT; @@ -459,12 +462,16 @@ export async function recordOptionsListChangeHistory(runner, { articleId, compan /** Records image addition to an article. */ export async function recordImageAddHistory(runner, { articleId, companyuserId, date, fullHash, sort, skelehash }) { + if (!fullHash) throw new Error('fullHash required for image history'); + if (!skelehash) throw new Error('skelehash required for image history'); const text = typeof sort === 'number' ? `Bild hinzugefügt (Position ${sort + 1})` : 'Bild hinzugefügt'; return recordArticleHistory(runner, { articleId, companyuserId, date, text, meta: { type: 'image_add', fullHash, sort, skelehash } }); } /** Records image deletion from an article. */ export async function recordImageDeleteHistory(runner, { articleId, companyuserId, date, fullHash, skelehash }) { + if (!fullHash) throw new Error('fullHash required for image history'); + if (!skelehash) throw new Error('skelehash required for image history'); return recordArticleHistory(runner, { articleId, companyuserId, date, text: 'Bild gelöscht', meta: { type: 'image_delete', fullHash, skelehash } }); }