Skip to content

Commit c50b379

Browse files
authored
Merge pull request #36053 from nextcloud/backport/36043/stable25
[stable25] Link reference provider: Improve content-type check
2 parents dc750d7 + e9dc352 commit c50b379

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/private/Collaboration/Reference/LinkReferenceProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ private function fetchReference(Reference $reference): void {
116116
return;
117117
}
118118
$linkContentType = $headResponse->getHeader('Content-Type');
119-
if ($linkContentType !== 'text/html') {
119+
$expectedContentType = 'text/html';
120+
$suffixedExpectedContentType = $expectedContentType . ';';
121+
$startsWithSuffixed = substr($linkContentType, 0, strlen($suffixedExpectedContentType)) === $suffixedExpectedContentType;
122+
// check the header begins with the expected content type
123+
if ($linkContentType !== $expectedContentType && !$startsWithSuffixed) {
120124
$this->logger->debug('Skip resolving links pointing to content type that is not "text/html"');
121125
return;
122126
}

0 commit comments

Comments
 (0)