Skip to content

Commit

Permalink
Fix tests: avoid escaping inside attributes a[href] and img[src]
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Apr 2, 2024
1 parent b8e50f4 commit c424f46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion models/parser/TranslationPurifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ public static function configure($config)

// Allow specific tags and attributes
$config->set('HTML.Allowed', 'p,b,i,u,s,a[href|target],img[src|alt],ul,ol,li,blockquote,code,pre,span,hr,br,strong');

// Allow non-ASCII characters
$config->set('Core.EscapeNonASCIICharacters', false);

// To avoid escaping inside the attributes
$def = $config->getHTMLDefinition(true);
$def->addAttribute('a', 'href', new ParameterURIDef());
$def->addAttribute('img', 'src', new ParameterURIDef());
}
}

0 comments on commit c424f46

Please sign in to comment.