Fix debug tool to insert messages with attachments.

This commit is contained in:
Greyson Parrelli
2025-08-07 13:56:40 -04:00
parent 8e6664f41c
commit 7cf170ab3d
3 changed files with 31 additions and 9 deletions

View File

@@ -1986,6 +1986,24 @@ class AttachmentTable(
.run()
}
fun debugMakeValidForArchive(attachmentId: AttachmentId) {
writableDatabase
.execSQL(
"""
UPDATE $TABLE_NAME
SET $DATA_HASH_END = $DATA_HASH_START
WHERE $ID = ${attachmentId.id}
"""
)
writableDatabase
.update(TABLE_NAME)
.values(
REMOTE_KEY to Base64.encodeWithPadding(Util.getSecretBytes(64)),
REMOTE_DIGEST to Util.getSecretBytes(64)
)
}
/**
* Deletes the data file if there's no strong references to other attachments.
* If deleted, it will also clear all weak references (i.e. quotes) of the attachment.