Fix possible invalid poll export.

This commit is contained in:
Greyson Parrelli
2025-12-03 11:32:31 -05:00
committed by jeffrey-signal
parent 464345ee5f
commit ab5426e6bb
2 changed files with 9 additions and 0 deletions

View File

@@ -135,6 +135,10 @@ object ExportSkips {
return log(sentTimestamp, "Poll option was invalid.") return log(sentTimestamp, "Poll option was invalid.")
} }
fun pollNotInGroupChat(sentTimestamp: Long): String {
return log(sentTimestamp, "Poll was not in a group chat.")
}
fun individualChatUpdateInWrongTypeOfChat(sentTimestamp: Long): String { fun individualChatUpdateInWrongTypeOfChat(sentTimestamp: Long): String {
return log(sentTimestamp, "A chat update that only makes sense for individual chats was found in a different kind of chat.") return log(sentTimestamp, "A chat update that only makes sense for individual chats was found in a different kind of chat.")
} }

View File

@@ -395,6 +395,11 @@ class ChatItemArchiveExporter(
} }
extraData.pollsById[record.id] != null -> { extraData.pollsById[record.id] != null -> {
if (exportState.threadIdToRecipientId[builder.chatId] !in exportState.groupRecipientIds) {
Log.w(TAG, ExportSkips.pollNotInGroupChat(record.dateSent))
continue
}
val poll = extraData.pollsById[record.id]!! val poll = extraData.pollsById[record.id]!!
if (poll.question.isEmpty() || poll.question.length > MAX_POLL_CHARACTER_LENGTH) { if (poll.question.isEmpty() || poll.question.length > MAX_POLL_CHARACTER_LENGTH) {
Log.w(TAG, ExportSkips.invalidPollQuestion(record.dateSent)) Log.w(TAG, ExportSkips.invalidPollQuestion(record.dateSent))