summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2023-01-09 11:08:56 +0100
committerJulien Veyssier <julien-nc@posteo.net>2023-01-10 16:12:07 +0100
commite9dc3526e935fab9921070d327fa91bda7ea8efb (patch)
treebac03b794c45ee8d5973517b6c25842dde376e7f /lib
parenta39887271138d12bb90b3ac2db7707bc579341b2 (diff)
downloadnextcloud-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.php6
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;
}