Reject attachments that exceed the allowed size

Closes #1468
This commit is contained in:
Torsten Grote
2019-02-18 15:05:04 -03:00
parent 6167ba5c46
commit f76f9be4ed
9 changed files with 125 additions and 30 deletions

View File

@@ -0,0 +1,6 @@
package org.briarproject.briar.api.messaging;
import java.io.IOException;
public class FileTooBigException extends IOException {
}

View File

@@ -20,7 +20,8 @@ public interface MessagingConstants {
/**
* The maximum allowed size of image attachments.
* TODO: Different limit for GIFs?
*/
int MAX_IMAGE_SIZE = 6 * 1024 * 1024;
int MAX_IMAGE_SIZE = MAX_MESSAGE_BODY_LENGTH; // 6 * 1024 * 1024;
}

View File

@@ -37,6 +37,8 @@ public interface MessagingManager extends ConversationClient {
/**
* Stores a local attachment message.
*
* @throws FileTooBigException
*/
AttachmentHeader addLocalAttachment(GroupId groupId, long timestamp,
String contentType, InputStream is) throws DbException, IOException;