Skip to content

Commit

Permalink
ImageProxy: avoid oversight of wrapping an entire HTML document aroun…
Browse files Browse the repository at this point in the history
…d image

In reply to <FreshRSS#206 (comment)>.

With special thanks to this comment: <https://www.php.net/manual/en/domdocument.savehtml.php#119767>
  • Loading branch information
Frenzie committed Mar 4, 2024
1 parent 189406e commit 9fcee2c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xExtension-ImageProxy/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static function swapUris(string $content): string {

$doc = new DOMDocument();
libxml_use_internal_errors(true); // prevent tag soup errors from showing
$doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
$doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$imgs = $doc->getElementsByTagName('img');
foreach ($imgs as $img) {
if ($img->hasAttribute('src')) {
Expand Down

0 comments on commit 9fcee2c

Please sign in to comment.