1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Limit small message size

This commit is contained in:
M66B 2020-09-13 14:38:36 +02:00
parent c8864d08d3
commit 0b7918a077
2 changed files with 4 additions and 3 deletions

View file

@ -2845,11 +2845,11 @@ class Core {
if (download && message.size != null && !message.ui_hide) {
long maxSize;
if (state == null || state.networkState.isUnmetered())
maxSize = MessageHelper.DEFAULT_DOWNLOAD_SIZE;
maxSize = MessageHelper.SMALL_MESSAGE_SIZE;
else {
maxSize = prefs.getInt("download", MessageHelper.DEFAULT_DOWNLOAD_SIZE);
if (maxSize == 0)
maxSize = MessageHelper.DEFAULT_DOWNLOAD_SIZE;
if (maxSize == 0 || maxSize > MessageHelper.SMALL_MESSAGE_SIZE)
maxSize = MessageHelper.SMALL_MESSAGE_SIZE;
}
if (message.size < maxSize) {

View file

@ -113,6 +113,7 @@ public class MessageHelper {
private static File cacheDir = null;
static final int SMALL_MESSAGE_SIZE = 192 * 1024; // bytes
static final int DEFAULT_DOWNLOAD_SIZE = 256 * 1024; // bytes
static final String HEADER_CORRELATION_ID = "X-Correlation-ID";