branch develop-1.1.x updated (34d6cd0 -> 2b8677b)
This is an automated email from the git hooks/post-receive script. New change to branch develop-1.1.x in repository faxtomail. See http://git.codelutin.com/faxtomail.git from 34d6cd0 à la réception des emails, remplacement des images dont l'url est incorrecte par l'image par défaut (configurable) (fixes #7855) new 2b8677b - correction dans la verfi des url des images à la reception des emails - ajout de tests avec des emails anonymisés The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 2b8677baf43ddf4efc41df2a97bc5c11674cae11 Author: Kevin Morin <morin@codelutin.com> Date: Wed Dec 23 11:15:42 2015 +0100 - correction dans la verfi des url des images à la reception des emails - ajout de tests avec des emails anonymisés Summary of changes: .../faxtomail/services/FaxToMailServiceUtils.java | 6 +- .../services/service/EmailServiceTest.java | 34 +++++--- .../src/test/resources/emails/test6863.eml | 8 ++ .../src/test/resources/emails/test7716.eml | 31 ++++++++ .../src/test/resources/emails/test7855.eml | 91 ++++++++++++++++++++++ 5 files changed, 156 insertions(+), 14 deletions(-) create mode 100644 faxtomail-service/src/test/resources/emails/test6863.eml create mode 100644 faxtomail-service/src/test/resources/emails/test7716.eml create mode 100644 faxtomail-service/src/test/resources/emails/test7855.eml -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop-1.1.x in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 2b8677baf43ddf4efc41df2a97bc5c11674cae11 Author: Kevin Morin <morin@codelutin.com> Date: Wed Dec 23 11:15:42 2015 +0100 - correction dans la verfi des url des images à la reception des emails - ajout de tests avec des emails anonymisés --- .../faxtomail/services/FaxToMailServiceUtils.java | 6 +- .../services/service/EmailServiceTest.java | 34 +++++--- .../src/test/resources/emails/test6863.eml | 8 ++ .../src/test/resources/emails/test7716.eml | 31 ++++++++ .../src/test/resources/emails/test7855.eml | 91 ++++++++++++++++++++++ 5 files changed, 156 insertions(+), 14 deletions(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java index 2ec2616..0e5103b 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java @@ -134,12 +134,10 @@ public class FaxToMailServiceUtils { for (String imgSrcUrl : imgSrcUrls) { - String correctImgUrl; + String correctImgUrl = URIUtil.encodeQuery(imgSrcUrl); try { // test if the url is correct (cf #7855) - new URL(imgSrcUrl); - - correctImgUrl = URIUtil.encodeQuery(imgSrcUrl); + new URL(correctImgUrl); } catch (MalformedURLException e) { //if incorrect, replace it with the default image 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 dc9c48c..4d57573 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 @@ -293,11 +293,26 @@ public class EmailServiceTest extends AbstractFaxToMailServiceTest { } @Test - public void testConvertHTMLToPdf() { + public void test6863() { + testConvertHTMLToPdf("test6863"); + } + + @Test + public void test7716() { + testConvertHTMLToPdf("test7716"); + } + + @Test + public void test7855() { + testConvertHTMLToPdf("test7855"); + } + + protected void testConvertHTMLToPdf(String emailId) { + + File tempDirectory = FileUtils.getTempDirectory(); try { -// File email = new File("src/test/resources/test.txt"); - File email = new File("/home/kmorin/Téléchargements/test2.eml"); + File email = new File("src/test/resources/emails/" + emailId + ".eml"); String emailContent = FileUtils.readFileToString(email); Properties properties = new Properties(); @@ -314,15 +329,15 @@ public class EmailServiceTest extends AbstractFaxToMailServiceTest { List<String> htmlContent = service.decomposeMultipartEmail(attachments, message); - Attachment attachment = service.convertHTMLToPdf(attachments, htmlContent, "test"); - Files.copy(attachment.getOriginalFile().getFile(), new File("/tmp/test.pdf")); + Attachment attachment = service.convertHTMLToPdf(attachments, htmlContent, emailId); + Files.copy(attachment.getOriginalFile().getFile(), new File(tempDirectory, emailId + ".pdf")); } else if (message.isMimeType("text/*")) { // convertit le contenu texte en PDF String content = IOUtils.toString(message.getInputStream(), charset); if (StringUtils.isNotBlank(content)) { - Attachment attachment = service.convertTextToPdf(content, "test"); - Files.copy(attachment.getOriginalFile().getFile(), new File("/tmp/test.pdf")); + Attachment attachment = service.convertTextToPdf(content, emailId); + Files.copy(attachment.getOriginalFile().getFile(), new File(tempDirectory, emailId + ".pdf")); } } else { String fileName = message.getFileName(); @@ -347,12 +362,11 @@ public class EmailServiceTest extends AbstractFaxToMailServiceTest { // save attachment attachments.add(attachment); - Files.copy(attachment.getOriginalFile().getFile(), new File("/tmp/test.pdf")); + Files.copy(attachment.getOriginalFile().getFile(), new File(tempDirectory, emailId + ".pdf")); } - } catch (Exception e) { - e.printStackTrace(); + Assert.fail(e.getMessage()); } } diff --git a/faxtomail-service/src/test/resources/emails/test6863.eml b/faxtomail-service/src/test/resources/emails/test6863.eml new file mode 100644 index 0000000..e4056e2 --- /dev/null +++ b/faxtomail-service/src/test/resources/emails/test6863.eml @@ -0,0 +1,8 @@ +MIME-Version: 1.0 +Subject: test 6863 +Message-ID: <325364397.0.1447683760764.JavaMail> +Content-Type: application/pdf; name="test6863.pdf" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename="test6863.pdf" + +JVBERi0xLjQKJeLjz9MKMiAwIG9iago8PC9MZW5ndGggMTAwL0ZpbHRlci9GbGF0ZURlY29kZT4+c3RyZWFtCnicK+RyCuEyUDAzNtQzVQhJ4XIN4QrkKuQy0DMwNjdVKOcyUvACSmdxGRoo+HJFxxoopHAZmymYWpoCledymRga6BmZQrk5MK6xmZ6BCZALVIjEhCnK4ArnygNbEsgFADqZGOwKZW5kc3RyZWFtCmVuZG9iagoxIDAgb2JqCjw8L1BhcmVudCAzIDAgUi9Db250ZW50cyAyIDAgUi9UeXBlL1BhZ2UvUmVzb3VyY2VzPDw+Pi9NZWRpYUJveFswIDAgNDQ2LjI1IDYzMS41XT4+CmVuZG9iago0IDAgb2JqCjw8L1R5cGUvWE9iamVjdC9Db2xvclNwYWNlL0RldmljZUdyYXkvU3VidHlwZS9JbWFnZS9CaXRzUGVyQ29tcG9uZW50IDgvV2lkdGggMTAw [...] diff --git a/faxtomail-service/src/test/resources/emails/test7716.eml b/faxtomail-service/src/test/resources/emails/test7716.eml new file mode 100644 index 0000000..4d261db --- /dev/null +++ b/faxtomail-service/src/test/resources/emails/test7716.eml @@ -0,0 +1,31 @@ +Return-Path: <contact@cimino-espace-maconnerie.fr> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="Apple-Mail=_51C20C20-2115-4295-927F-5379E6212669" +Subject: Test 7714 +X-Mailer: Apple Mail (2.1878.6) + +--Apple-Mail=_51C20C20-2115-4295-927F-5379E6212669 +Content-Type: multipart/mixed; + boundary="Apple-Mail=_CDF68BA5-30D4-4CD7-8FB1-06459A2104DF" + +--Apple-Mail=_CDF68BA5-30D4-4CD7-8FB1-06459A2104DF +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html; charset="windows-1252" + +<html><head> +<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1= +252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space;= + -webkit-line-break: after-white-space;">Bonjour, </body></html>= + +--Apple-Mail=_CDF68BA5-30D4-4CD7-8FB1-06459A2104DF +Content-Transfer-Encoding: 7bit +Content-Type: text/html; charset="us-ascii" + +<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div apple-content-edited="true"><span>test</span> +</div> +<br></body></html> +--Apple-Mail=_CDF68BA5-30D4-4CD7-8FB1-06459A2104DF-- + +--Apple-Mail=_51C20C20-2115-4295-927F-5379E6212669-- + diff --git a/faxtomail-service/src/test/resources/emails/test7855.eml b/faxtomail-service/src/test/resources/emails/test7855.eml new file mode 100644 index 0000000..716bdf5 --- /dev/null +++ b/faxtomail-service/src/test/resources/emails/test7855.eml @@ -0,0 +1,91 @@ +Subject: test 7855 +Accept-Language: fr-FR, en-US +Content-Language: fr-FR +Content-Type: multipart/alternative; + boundary="_000_7C51F096CFBF6444A4527AC13C0365C2AB4520E2S8EXCP01" +MIME-Version: 1.0 + +--_000_7C51F096CFBF6444A4527AC13C0365C2AB4520E2S8EXCP01 +Content-Type: text/html; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr= +osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" = +xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:= +//www.w3.org/TR/REC-html40"> +<head> +<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-= +1"> +<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)"> +<!--[if !mso]><style>v\:* {behavior:url(#default#VML);} +o\:* {behavior:url(#default#VML);} +w\:* {behavior:url(#default#VML);} +.shape {behavior:url(#default#VML);} +</style><![endif]--><style><!-- +/* Font Definitions */ +@font-face + {font-family:Calibri; + panose-1:2 15 5 2 2 2 4 3 2 4;} +@font-face + {font-family:Tahoma; + panose-1:2 11 6 4 3 5 4 4 2 4;} +/* Style Definitions */ +p.MsoNormal, li.MsoNormal, div.MsoNormal + {margin:0cm; + margin-bottom:.0001pt; + font-size:12.0pt; + font-family:"Times New Roman","serif";} +a:link, span.MsoHyperlink + {mso-style-priority:99; + color:blue; + text-decoration:underline;} +a:visited, span.MsoHyperlinkFollowed + {mso-style-priority:99; + color:purple; + text-decoration:underline;} +p.MsoAcetate, li.MsoAcetate, div.MsoAcetate + {mso-style-priority:99; + mso-style-link:"Texte de bulles Car"; + margin:0cm; + margin-bottom:.0001pt; + font-size:8.0pt; + font-family:"Tahoma","sans-serif";} +span.spelle + {mso-style-name:spelle;} +span.EmailStyle18 + {mso-style-type:personal; + font-family:"Calibri","sans-serif"; + color:#1F497D;} +span.EmailStyle19 + {mso-style-type:personal-reply; + font-family:"Calibri","sans-serif"; + color:#1F497D;} +span.TextedebullesCar + {mso-style-name:"Texte de bulles Car"; + mso-style-priority:99; + mso-style-link:"Texte de bulles"; + font-family:"Tahoma","sans-serif";} +.MsoChpDefault + {mso-style-type:export-only; + font-size:10.0pt;} +@page WordSection1 + {size:612.0pt 792.0pt; + margin:70.85pt 70.85pt 70.85pt 70.85pt;} +div.WordSection1 + {page:WordSection1;} +--></style><!--[if gte mso 9]><xml> +<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> +</xml><![endif]--><!--[if gte mso 9]><xml> +<o:shapelayout v:ext=3D"edit"> +<o:idmap v:ext=3D"edit" data=3D"1" /> +</o:shapelayout></xml><![endif]--> +</head> +<body lang=3D"FR" link=3D"blue" vlink=3D"purple"> +<div class=3D"WordSection1"> +<img border=3D"0" width=3D"172" height=3D"51" id=3D"= +_x0000_i1025" src=3D"outbind://96/Seher_fichiers/image001.jpg"> +</div> +</body> +</html> + +--_000_7C51F096CFBF6444A4527AC13C0365C2AB4520E2S8EXCP01-- -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm