mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Add various backup fixes for polls.
This commit is contained in:
committed by
jeffrey-signal
parent
3f5a4ebf7b
commit
47201f4955
@@ -120,6 +120,8 @@ import kotlin.time.Duration.Companion.seconds
|
||||
object DataMessageProcessor {
|
||||
|
||||
private const val BODY_RANGE_PROCESSING_LIMIT = 250
|
||||
private const val POLL_CHARACTER_LIMIT = 100
|
||||
private const val POLL_OPTIONS_LIMIT = 10
|
||||
|
||||
fun process(
|
||||
context: Context,
|
||||
@@ -1079,6 +1081,16 @@ object DataMessageProcessor {
|
||||
return null
|
||||
}
|
||||
|
||||
if (poll.question == null || poll.question!!.isEmpty() || poll.question!!.length > POLL_CHARACTER_LIMIT) {
|
||||
warn(envelope.timestamp!!, "[handlePollCreate] Poll question is invalid.")
|
||||
return null
|
||||
}
|
||||
|
||||
if (poll.options.isEmpty() || poll.options.size > POLL_OPTIONS_LIMIT || poll.options.any { it.isEmpty() || it.length > POLL_CHARACTER_LIMIT }) {
|
||||
warn(envelope.timestamp!!, "[handlePollCreate] Poll option is invalid.")
|
||||
return null
|
||||
}
|
||||
|
||||
val pollMessage = IncomingMessage(
|
||||
type = MessageType.NORMAL,
|
||||
from = senderRecipient.id,
|
||||
|
||||
Reference in New Issue
Block a user