aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2023-01-10 16:17:52 +0100
committerJulien Veyssier <julien-nc@posteo.net>2023-01-10 16:17:52 +0100
commitf0589523c80749b1bdfbbfea34b141cd562e216b (patch)
tree82850d951d7a029c8742e8e23edd09fe6f4a441d
parentfc096ae9db18e3d62ad616588462edccd2d82f26 (diff)
downloadnextcloud-server-f0589523c80749b1bdfbbfea34b141cd562e216b.tar.gz
nextcloud-server-f0589523c80749b1bdfbbfea34b141cd562e216b.zip
improve link reference content-type check, accept 'text/html;*'
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
-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;
}