Mail attachment limitations (magic numbers)
Posted: Wed Sep 02, 2009 2:02 pm
Hi all,
I'm experimenting with the attachment-functionality of our OpenEMM-System (5.5.1 / Windows).
I want to attach big (> 1MB) pdf-files.
By testing and browsing the source and forums, i found that a file ending with ".pdf" will be rejected by OpenEMM saying its too big, if the file size is larger than 436906 Bytes. I've tested this with two pdf-files, one of size 436906 the other of size 436907, the first one got accepted, the second rejected.
The reason is that files ending with ".pdf" are tested whether their size times 2.4 exceeds a hardcoded limit of 1048576 Bytes (exactly one Megabyte):
My Question is: will changing the hardcoded limit and compiling and exchanging just this class solve my problem?
And will this limit be configurable in future-versions (maybe in OpenEMM 6) ?
Thanks in advance and happy OpenEMM'ing to all!
-diax
I'm experimenting with the attachment-functionality of our OpenEMM-System (5.5.1 / Windows).
I want to attach big (> 1MB) pdf-files.
By testing and browsing the source and forums, i found that a file ending with ".pdf" will be rejected by OpenEMM saying its too big, if the file size is larger than 436906 Bytes. I've tested this with two pdf-files, one of size 436906 the other of size 436907, the first one got accepted, the second rejected.
The reason is that files ending with ".pdf" are tested whether their size times 2.4 exceeds a hardcoded limit of 1048576 Bytes (exactly one Megabyte):
Code: Select all
try {
double size = newAttachment.getFileSize();
String fileName = newAttachment.getFileName().toLowerCase();
if(fileName.endsWith(".pdf")) {
size = size * 2.4;
}
if(size != 0 && size < 1048576) {
[...]
// attachment gets saved
[...]
} else if(size >= 1048576) {
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.attachment"));
}
} catch(Exception e) {
AgnUtils.logger().error("saveAttachment: "+e);
}
And will this limit be configurable in future-versions (maybe in OpenEMM 6) ?
Thanks in advance and happy OpenEMM'ing to all!
-diax