Avoid foreign key error if message is deleted before saving attachments

This commit is contained in:
trevor-signal
2025-09-17 13:38:34 -04:00
committed by GitHub
parent 234d238786
commit c98a346b0c

View File

@@ -2997,10 +2997,6 @@ function saveMessage(
} satisfies Omit<MessageTypeUnhydrated, 'json'>;
if (id && !forceSave) {
if (normalizeAttachmentData) {
saveMessageAttachments(db, message);
}
const result = db
.prepare(
// UPDATE queries that set the value of a primary key column can be very slow when
@@ -3019,6 +3015,10 @@ function saveMessage(
return id;
}
if (normalizeAttachmentData) {
saveMessageAttachments(db, message);
}
if (jobToInsert) {
insertJob(db, jobToInsert);
}