Search code examples
phphtmlhtmlpurifier

Allow background-image : with embedded data in html purifier


I'm new to html purifier and I'm trying to configure this library according to my needs.

So I have got this html source :

<div style="background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAA8CAYAAABIFuztAAA....);">Text</div>

My config is :

$config->set('URI.AllowedSchemes', array('http' => true, 'https' => true, 'mailto' => true, 'ftp' => true, 'nntp' => true, 'news' => true, 'data' => true));

Solution

  • Bug in HTML purifier lib fixed in the next's versions. https://github.com/ezyang/htmlpurifier/commit/5070404376d3b4287ce5c6bfae13e888b464742d