This is an automated email from the git hooks/post-receive script. New commit to branch develop-1.1.x in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 88fbdb30f9adf634daf690e061ca4d817e7a0e85 Author: jcouteau <couteau@codelutin.com> Date: Mon Mar 29 15:52:18 2021 +0200 Font-size too small normalement corrigé --- .../services/service/EmailServiceImpl.java | 30 +++++++++++++++------- .../services/service/EmailServiceTest.java | 10 ++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java index 190dd420..55ea1d28 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java @@ -2030,7 +2030,11 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe if (decomposingForwardedEmail > 0) { plainTextFileName += decomposingForwardedEmail; } - + String htmlFileName = t("faxtomail.email.content.attachment.htmlFileName"); + if (decomposingForwardedEmail > 0) { + htmlFileName += decomposingForwardedEmail; + } + List<Attachment> attachments = new ArrayList<>(); if (message.isMimeType("multipart/*")) { @@ -2040,17 +2044,14 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe if (log.isDebugEnabled()) { log.debug("Converting html content to pdf : " + message.getSubject()); } - String htmlFileName = t("faxtomail.email.content.attachment.htmlFileName"); - if (decomposingForwardedEmail > 0) { - htmlFileName += decomposingForwardedEmail; - } Attachment attachment = convertHTMLToPdf(attachments, htmlContent, htmlFileName); if (attachment != null) { - //remove text plain attachement if exists, to avoid having twice the mail content in the attachments + attachment.setAddedByUser(false); + //remove text plain attachement if exists, to avoid having twice the mail content in the attachments for (Attachment a : attachments) { - if (plainTextFileName.equals(a.getOriginalFileName())) { + if (plainTextFileName.equals(FileUtil.basename(a.getOriginalFileName(), ".pdf"))) { attachments.remove(a); break; } @@ -2064,8 +2065,19 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe String content = FaxToMailServiceUtils.getTextFromMessage(message); if (StringUtils.isNotBlank(content)) { - Attachment attachment = convertTextToPdf(content, plainTextFileName); - attachments.add(0, attachment); + boolean alreadyHtmlContent = false; + //remove html attachement if exists, to avoid having twice the mail content in the attachments + for (Attachment a : attachments) { + if (htmlFileName.equals(FileUtil.basename(a.getOriginalFileName(), ".pdf"))) { + alreadyHtmlContent = true; + break; + } + } + if (!alreadyHtmlContent) { + Attachment attachment = convertTextToPdf(content, plainTextFileName); + attachment.setAddedByUser(false); + attachments.add(0, attachment); + } } //directly an attachment diff --git a/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java b/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java index 2bcc6feb..48dd1292 100644 --- a/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java +++ b/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java @@ -324,6 +324,16 @@ public class EmailServiceTest extends AbstractFaxToMailServiceTest { testConvertHTMLToPdf("test10029"); } + /** + * Test qui permet de vérifier la génération de sPDF pour les mails contenant des font-size:0 + */ + @Test + public void test10123() { + testConvertHTMLToPdf("test10123"); + + } + + protected void testConvertHTMLToPdf(String emailId) { File tempDirectory = FileUtils.getTempDirectory(); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.