Commit Graph

38 Commits

Author SHA1 Message Date
Denis Ledoux 31e8bb8e9d [FIX] mail: better signature detection
This revision back-ports revisions
983d5eb9fa
&
ccbb8e09a6
regarding this signature regex.

Besides, it adds the fact the dashes have to
be at the beginning of the line
to make them detected as a signature.

opw-655834
2015-11-30 14:48:59 +01:00
Martin Trigaux bd52298073 [IMP] mail: parsing emails with several html parts
If an email contains several text/html parts inside a multipart email, the previous code was only keeping the last content part.
The Content-Type: multipart/mixed allows several independent part (RFC1341 7.2.2), so two html is technically valid.
With this patch, the two parts are concatenated. (opw 614755)

Modify append_content_to_html regex to make sure the regex keeps the content of the html instead of removing it.
e.g.: "123 <html> 456 </html> 789" used to be stripped to "123  789" while we expect "123 456 789"
2014-10-09 13:53:23 +02:00
Denis Ledoux d824769b3c [FIX] tools,mail: improve parsing of references from rev. 0bee015dd6
Backport of 8.0 fix was not enough for 7.0, because it still fails for the legacy reference match (model+res_id), which is not used in 8.0
2014-09-05 11:44:20 +02:00
Desai Binjal 8fe9f07cac [FIX] note: small bugs 2014-08-21 15:55:23 +02:00
Thibault Delavallée 7a928b151a [FIX] tools: mail: fixed last commit, solving an issue with the html2plaintext introduced another issue with notes. Reverting to the first version. 2014-07-11 16:21:01 +02:00
Anand-Dharampuriya 5cbc611361 [FIX] Solve some mail issues which are currently present in 7.0 2014-07-10 16:29:54 +02:00
Martin Trigaux e328c0a40e [FIX] html_sanitize: partial backport of trunk revision 5047.
Unescape elements that have been wrongly escaped.

Some elements (eg: 'href' tag in links) are sanitised in templates which prevents the execution of mako templates.

lp bug: https://launchpad.net/bugs/1273251 fixed

bzr revid: mat@openerp.com-20140210144023-9sp8cqn07ta5o64y
2014-02-10 15:40:23 +01:00
Olivier Dony 7a819ca8d0 [FIX] tools.email_split: improve email extraction using stdlib + extra tests
The original code was having issues telling apart
names containing emails from the actual email.
This patch is inspired by Etienne Hirt's patch
on bug 1165531 for OpenERP 6.1.
This will also help solve bug 1199386, if we can
centralize all email parsing through this helper.

lp bug: https://launchpad.net/bugs/1199386 fixed
lp bug: https://launchpad.net/bugs/1165531 fixed

bzr revid: odo@openerp.com-20140114154426-usu6intv5139egd3
2014-01-14 16:44:26 +01:00
Christophe Simonis 7ba1d747cc [FIX] html_sanitize: handle the case of empty documents (after sanitization).
[IMP] test_mail: do not mute logger

bzr revid: chs@openerp.com-20131113113715-tzaog0d6o2u4q0x4
2013-11-13 12:37:15 +01:00
Christophe Matthieu 600f03b294 [FIX] html2plaintext: bug 1159782
bzr revid: chm@openerp.com-20130329154130-56wjtfrj41eatxl6
2013-03-29 16:41:30 +01:00
Cedric Snauwaert f05aff8ac9 [FIX]tools/mail: fix regex when sanitizing html containing mail address
bzr revid: csn@openerp.com-20130308104850-02nfuaxdr91bo0nx
2013-03-08 11:48:50 +01:00
Christophe Matthieu 21c5425d89 [IMP] mail_sanitize: simplification of the regular expression
bzr revid: chm@openerp.com-20130102162544-jfwdfqx2ruf0x1q2
2013-01-02 17:25:44 +01:00
Christophe Matthieu a4e7fa97f4 [IMP] mail sanitize: add special email address for escape in the sanitizer
bzr revid: chm@openerp.com-20130102090040-yh0vdv8b3mtwoebh
2013-01-02 10:00:40 +01:00
Christophe Matthieu 71a92f46e4 [FIX] tools: html_sanitize
bzr revid: chm@openerp.com-20121231154451-0guqjid92rfndghp
2012-12-31 16:44:51 +01:00
Fabien Pinckaers a74d50d220 [IMP] support for lxml <2.3.1
bzr revid: fp@tinyerp.com-20121227163324-uloesoeixirmdtka
2012-12-27 17:33:24 +01:00
Thibault Delavallée 1c7b1b53d4 [IMP] sanitizer: improved logger message if crashed during sanitize.
bzr revid: tde@openerp.com-20121227092614-0ihi5sw5uuyboahk
2012-12-27 10:26:14 +01:00
Thibault Delavallée be5118c704 [DOC] Added some comments. Updated failure message. Added a logging message when not capable of parsing.
bzr revid: tde@openerp.com-20121226164354-tjquf1zdyr90tl5e
2012-12-26 17:43:54 +01:00
Thibault Delavallée d7185be38c [IMP] html_sanitize: now uses the builtin cleaner of lxml.html. We also allows style attribute; the cleaner ensures no javascript or malicious code goes through those attributes. Updated and added tests for the sanitizer, especially about malicious code, and EDI-like html code.
bzr revid: tde@openerp.com-20121226162505-8rq060p375z1k9il
2012-12-26 17:25:05 +01:00
Christophe Matthieu 111e080e48 [IMP] tools mail: don't remove xml and doctype but remove encoding attribute
bzr revid: chm@openerp.com-20121219124038-05bf07960h05x0o8
2012-12-19 13:40:38 +01:00
Christophe Matthieu 125f80888e [FIX] tools mail: return the initial variable if is false or if is not an instance of basestring. remove xml and doctype tags.
bzr revid: chm@openerp.com-20121219103714-u52hfmqr5u508xa2
2012-12-19 11:37:14 +01:00
Olivier Dony 7f5ad72429 [MERGE] Forward-port 6.1 bugfixes up to rev. 4307
rev.4307 = rev-id launchpad_translations_on_behalf_of_openerp-20121125065030-g5if5pybr61la4yj

bzr revid: odo@openerp.com-20121126160320-t2suuik6lhk6wl0x
bzr revid: odo@openerp.com-20121126161836-mv8yymzgbnmif4ve
bzr revid: odo@openerp.com-20121126162023-ejvsapwouyudw6c6
bzr revid: odo@openerp.com-20121126181527-d4yx15372bis77qj
2012-11-26 19:15:27 +01:00
Christophe Matthieu 5bbce53e35 [FIX] tools mail : html_email_clean
bzr revid: chm@openerp.com-20121120154217-4ewxir45q1wtjoax
2012-11-20 16:42:17 +01:00
Christophe Matthieu 50f09660fb [FIX] tools mail: html_email_clean return False (standard OpenERP) if the param is False
bzr revid: chm@openerp.com-20121120134001-ivw9dqxha2du70o6
2012-11-20 14:40:01 +01:00
Christophe Matthieu e9a1f9f5a7 [FIX] tools mail: html_email_clean return an empty string if the are no value
bzr revid: chm@openerp.com-20121119105330-2kud8vp18gp15u9e
2012-11-19 11:53:30 +01:00
Thibault Delavallée 23743683ea [IMP] tools: html_email_clean: a bit more robust.
bzr revid: tde@openerp.com-20121114141452-n5jy3yzbmlbd3811
2012-11-14 15:14:52 +01:00
Thibault Delavallée 7508a5c724 [CLEAN] html_email_clean: cleaned a bit the code.
bzr revid: tde@openerp.com-20121114103817-t19i2sv817jsur41
2012-11-14 11:38:17 +01:00
Thibault Delavallée 62c419e66f [IMP] tools: mail: improved append_content_to_html, including plaintext2html. Updated tests.
bzr revid: tde@openerp.com-20121109123521-e04g4zrhtv947l1r
2012-11-09 13:35:21 +01:00
Thibault Delavallée e6a9084677 [IMP] tools: added text2html function, basically turning plaintext into html. Added a test for this function. Updated signature for demo data.
bzr revid: tde@openerp.com-20121107164117-2caoqna2aclzowpk
2012-11-07 17:41:17 +01:00
Thibault Delavallée b36547e3ef [CLEAN] tools: mail: removed commented code; moved some code.
bzr revid: tde@openerp.com-20121107154129-nhz7qjv1ksq521ur
2012-11-07 16:41:29 +01:00
Thibault Delavallée 688b6babed [FIX] tools: html_email_clean: remove blockquote in any node, not just firs childs of root.
bzr revid: tde@openerp.com-20121107105031-xf0u71q3chx0chnv
2012-11-07 11:50:31 +01:00
Thibault Delavallée 4d89845de6 [IMP] tools: tests: cleaner: cleaned a bit test data. Will have to be improved.
bzr revid: tde@openerp.com-20121107093201-s0pco15msilt4erz
2012-11-07 10:32:01 +01:00
Thibault Delavallée 3ba739cbf5 [IMP] tools: mail: improved basic html_email_clean.
bzr revid: tde@openerp.com-20121107085807-td2okmbr61pm4g1e
2012-11-07 09:58:07 +01:00
Thibault Delavallée a80fab6303 [FIX] tools: mail: use beautifulsoup parser, if not present, html parser.
bzr revid: tde@openerp.com-20121106133751-ds0g2c7k8pu4d6rl
2012-11-06 14:37:51 +01:00
Thibault Delavallée f2d53fd215 [FIX] tools: mail: fixed some import, cleaned some code.
bzr revid: tde@openerp.com-20121106124109-63svzi72lx2a13yq
2012-11-06 13:41:09 +01:00
Thibault Delavallée 1d52a68dd9 [IMP] tools: mail: added html_cleaner, to clean html code to display in chatter (remove quotes, signatures, ...).
bzr revid: tde@openerp.com-20121106121737-ej57bijc7ypksu8v
2012-11-06 13:17:37 +01:00
Thibault Delavallée 5f53f5253b [FIX] tools: some import cleaning and fixing.
bzr revid: tde@openerp.com-20121106115851-5f5sfhtp2g3qrm1o
2012-11-06 12:58:51 +01:00
Thibault Delavallée da6ad1e27c [REF] tools: moved email and mail related functions from misc to mail.
bzr revid: tde@openerp.com-20121106115744-pcxgyqv3lf8zfedw
2012-11-06 12:57:44 +01:00
Thibault Delavallée 207675a174 [REN] html_sanitize -> mail, to have a central file for methods about mail (html sanitizing, html management, emails related functions, ...).
bzr revid: tde@openerp.com-20121106115420-1h8mvzohol9zjysa
2012-11-06 12:54:20 +01:00