mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:04:53 +01:00
Fix mail integration fails for mails with having not encoded ampersands on their html content
This commit is contained in:
parent
f5e2f7e719
commit
59dbd27719
@ -491,13 +491,14 @@ class Html
|
|||||||
{
|
{
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
// try to cleanup not encoded ampersands used possibily in urls
|
||||||
|
$html = preg_replace('/&(?!#?[a-zA-Z0-9]+;)/', '&', $html);
|
||||||
|
|
||||||
$dom = new \DOMDocument('1.0','UTF-8');
|
$dom = new \DOMDocument('1.0','UTF-8');
|
||||||
$dom->loadHTML(
|
if(!$dom->loadHTML(
|
||||||
'<?xml encoding="UTF-8">'. Api\Translation::convert($html,false, 'utf8'),
|
'<?xml encoding="UTF-8">'. Api\Translation::convert($html,preg_match('/<meta[^>]+content="[^>"]+charset=([^;"]+)/i', $html, $matches) ? $matches[1] : false, 'utf8'),
|
||||||
LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOBLANKS
|
LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOBLANKS
|
||||||
);
|
))
|
||||||
if(!$dom)
|
|
||||||
{
|
{
|
||||||
// Failed to parse
|
// Failed to parse
|
||||||
return $html;
|
return $html;
|
||||||
|
Loading…
Reference in New Issue
Block a user