improve link reference content-type check, accept 'text/html;*'

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
Julien Veyssier 2023-01-10 16:17:52 +01:00
parent fc096ae9db
commit f0589523c8
No known key found for this signature in database
GPG key ID: 4141FEE162030638

View file

@ -117,8 +117,10 @@ class LinkReferenceProvider implements IReferenceProvider {
}
$linkContentType = $headResponse->getHeader('Content-Type');
$expectedContentType = 'text/html';
$suffixedExpectedContentType = $expectedContentType . ';';
$startsWithSuffixed = substr($linkContentType, 0, strlen($suffixedExpectedContentType)) === $suffixedExpectedContentType;
// check the header begins with the expected content type
if (substr($linkContentType, 0, strlen($expectedContentType)) !== $expectedContentType) {
if ($linkContentType !== $expectedContentType && !$startsWithSuffixed) {
$this->logger->debug('Skip resolving links pointing to content type that is not "text/html"');
return;
}