]> source.dussan.org Git - nextcloud-server.git/commitdiff
improve link reference content-type check, accept 'text/html;*' 36071/head
authorJulien Veyssier <julien-nc@posteo.net>
Tue, 10 Jan 2023 15:17:52 +0000 (16:17 +0100)
committerJulien Veyssier <julien-nc@posteo.net>
Tue, 10 Jan 2023 15:17:52 +0000 (16:17 +0100)
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
lib/private/Collaboration/Reference/LinkReferenceProvider.php

index 2cdfb2e0c91596c7104ebafc52e732f0912309cb..2a6d4d5afaf075abcde3b92c7cc27a7b0bc67129 100644 (file)
@@ -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;
                }