Skip to content

Commit

Permalink
Merge pull request #36053 from nextcloud/backport/36043/stable25
Browse files Browse the repository at this point in the history
[stable25] Link reference provider: Improve content-type check
  • Loading branch information
PVince81 authored Jan 11, 2023
2 parents dc750d7 + e9dc352 commit c50b379
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c50b379

Please sign in to comment.