diff options
author | Julien Veyssier <julien-nc@posteo.net> | 2023-01-09 11:08:56 +0100 |
---|---|---|
committer | Julien Veyssier <julien-nc@posteo.net> | 2023-01-10 16:12:07 +0100 |
commit | e9dc3526e935fab9921070d327fa91bda7ea8efb (patch) | |
tree | bac03b794c45ee8d5973517b6c25842dde376e7f /lib | |
parent | a39887271138d12bb90b3ac2db7707bc579341b2 (diff) | |
download | nextcloud-server-e9dc3526e935fab9921070d327fa91bda7ea8efb.tar.gz nextcloud-server-e9dc3526e935fab9921070d327fa91bda7ea8efb.zip |
in the link reference provider, check if the link content type begins with text/html
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Collaboration/Reference/LinkReferenceProvider.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Collaboration/Reference/LinkReferenceProvider.php b/lib/private/Collaboration/Reference/LinkReferenceProvider.php index 583cbdcfe99..2a6d4d5afaf 100644 --- a/lib/private/Collaboration/Reference/LinkReferenceProvider.php +++ b/lib/private/Collaboration/Reference/LinkReferenceProvider.php @@ -116,7 +116,11 @@ class LinkReferenceProvider implements IReferenceProvider { return; } $linkContentType = $headResponse->getHeader('Content-Type'); - if ($linkContentType !== 'text/html') { + $expectedContentType = 'text/html'; + $suffixedExpectedContentType = $expectedContentType . ';'; + $startsWithSuffixed = substr($linkContentType, 0, strlen($suffixedExpectedContentType)) === $suffixedExpectedContentType; + // check the header begins with the expected content type + if ($linkContentType !== $expectedContentType && !$startsWithSuffixed) { $this->logger->debug('Skip resolving links pointing to content type that is not "text/html"'); return; } |