Fetch abandoned attachment files in a transaction.

Not likely to affect anything because of the existin protected file
system, more just a defense-and-depth style thing.
This commit is contained in:
Greyson Parrelli
2026-01-12 10:16:52 -05:00
committed by Michelle Tang
parent c727f93534
commit 6a423cb18b

View File

@@ -1448,14 +1448,15 @@ class AttachmentTable(
val filesInDb: MutableSet<String> = HashSet(filesOnDisk.size)
readableDatabase
.select(DATA_FILE, THUMBNAIL_FILE)
.from(TABLE_NAME)
.run()
.forEach { cursor ->
cursor.requireString(DATA_FILE)?.let { filesInDb += it }
cursor.requireString(THUMBNAIL_FILE)?.let { filesInDb += it }
}
readableDatabase.withinTransaction { db ->
db.select(DATA_FILE, THUMBNAIL_FILE)
.from(TABLE_NAME)
.run()
.forEach { cursor ->
cursor.requireString(DATA_FILE)?.let { filesInDb += it }
cursor.requireString(THUMBNAIL_FILE)?.let { filesInDb += it }
}
}
filesInDb += SignalDatabase.stickers.getAllStickerFiles()