From e9dc3526e935fab9921070d327fa91bda7ea8efb Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 9 Jan 2023 11:08:56 +0100 Subject: [PATCH] in the link reference provider, check if the link content type begins with text/html Signed-off-by: Julien Veyssier --- .../Collaboration/Reference/LinkReferenceProvider.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Collaboration/Reference/LinkReferenceProvider.php b/lib/private/Collaboration/Reference/LinkReferenceProvider.php index 583cbdcfe9977..2a6d4d5afaf07 100644 --- a/lib/private/Collaboration/Reference/LinkReferenceProvider.php +++ b/lib/private/Collaboration/Reference/LinkReferenceProvider.php @@ -116,7 +116,11 @@ private function fetchReference(Reference $reference): void { 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; }