summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2023-01-11 11:02:38 +0100
committerGitHub <noreply@github.com>2023-01-11 11:02:38 +0100
commitb82db5fd5f5f23aec5f082358e1b5bff666b15c1 (patch)
treea74718562c66a3552c4dc0746a4d41dc575ea714
parentafa2953e67c08e9e351246b4d7359ae186caf295 (diff)
parentf0589523c80749b1bdfbbfea34b141cd562e216b (diff)
downloadnextcloud-server-b82db5fd5f5f23aec5f082358e1b5bff666b15c1.tar.gz
nextcloud-server-b82db5fd5f5f23aec5f082358e1b5bff666b15c1.zip
Merge pull request #36071 from nextcloud/enh/36043/improve-link-reference-content-type-check
improve link reference content-type check
-rw-r--r--lib/private/Collaboration/Reference/LinkReferenceProvider.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/private/Collaboration/Reference/LinkReferenceProvider.php b/lib/private/Collaboration/Reference/LinkReferenceProvider.php
index 2cdfb2e0c91..2a6d4d5afaf 100644
--- a/lib/private/Collaboration/Reference/LinkReferenceProvider.php
+++ b/lib/private/Collaboration/Reference/LinkReferenceProvider.php
@@ -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;
}