ezyang / htmlpurifier

Standards compliant HTML filter written in PHP
http://htmlpurifier.org
GNU Lesser General Public License v2.1
3.07k stars 327 forks source link

Base64 images are removed #345

Closed freescout-helpdesk closed 1 year ago

freescout-helpdesk commented 1 year ago

By some reason all <img src="data:image/png;base64,iVBORw0KGgoAA..." /> are being removed. Maybe someone can point out the direction where to dig.

Here is the config: https://github.com/freescout-helpdesk/freescout/blob/dist/config/purifier.php

ezyang/htmlpurifier v4.12.0 and v4.16.0

Original issue: https://github.com/freescout-helpdesk/freescout/issues/2355

freescout-helpdesk commented 1 year ago

doValidate() in https://github.com/ezyang/htmlpurifier/blob/master/library/HTMLPurifier/URIScheme/data.php#L36 is even never executed.

freescout-helpdesk commented 1 year ago

Solved:

            'URI.AllowedSchemes'   => [
                'http' => true,
                'https' => true,
                'mailto' => true,
                'ftp' => true,
                'nntp' => true,
                'news' => true,
                'tel' => true,
                'data' => true, // Add this!
            ],