Skip to content

Commit 97819a4

Browse files
Merge pull request #1704 from Infomaniak/subject-max-length
Truncate Message' Subject if it's longer than 998 characters
2 parents ea38c1c + fc83ab1 commit 97819a4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/src/main/java/com/infomaniak/mail/ui/newMessage/NewMessageViewModel.kt

+2
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ class NewMessageViewModel @Inject constructor(
633633
private fun saveDraftToLocal(action: DraftAction) {
634634
SentryLog.d("Draft", "Save Draft to local")
635635

636+
draft.subject = draft.subject?.take(SUBJECT_MAX_LENGTH)
636637
draft.body = draft.uiBody.textToHtml() + (draft.uiSignature ?: "") + (draft.uiQuote ?: "")
637638
draft.action = action
638639

@@ -733,5 +734,6 @@ class NewMessageViewModel @Inject constructor(
733734
companion object {
734735
private const val DELAY_BEFORE_AUTO_SAVING_DRAFT = 1_000L
735736
private const val FILE_SIZE_25_MB = 25L * 1_024L * 1_024L
737+
private const val SUBJECT_MAX_LENGTH = 998
736738
}
737739
}

0 commit comments

Comments
 (0)