Fix images downloading with numeric HTML entity

This commit is contained in:
Simounet
2023-05-29 15:12:04 +02:00
parent d049e3787c
commit 548b610a17
2 changed files with 24 additions and 5 deletions

View File

@ -86,12 +86,14 @@ class DownloadImages
continue;
}
// if image contains "&" and we can't find it in the html it might be because it's encoded as &
if (false !== stripos($image, '&') && false === stripos($html, $image)) {
$image = str_replace('&', '&', $image);
}
$html = str_replace($image, $newImage, $html);
// if image contains "&" and we can't find it in the html it might be because it's encoded as & or unicode
if (false !== stripos($image, '&') && false === stripos($html, $image)) {
$imageAmp = str_replace('&', '&', $image);
$html = str_replace($imageAmp, $newImage, $html);
$imageUnicode = str_replace('&', '&', $image);
$html = str_replace($imageUnicode, $newImage, $html);
}
}
return $html;