Skip to content

Commit

Permalink
[BUGFIX] Prevent double encoding of link test in index search
Browse files Browse the repository at this point in the history
Resolves: #88208
Releases: master, 9.5
Change-Id: I5ccf147f67de2a768fce344a33a8c6d80eece3f6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61972
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
NeoBlack authored and ervaude committed Oct 13, 2019
1 parent 311df41 commit 213c3d3
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ protected function compileSingleResultRow($row, $headerOnly = 0)
$copiedRow = $row;
unset($copiedRow['cHashParams']);
$title = $this->linkPageATagWrap(
htmlspecialchars($title),
$title,
$this->linkPage($row['page_id'], $copiedRow)
);
}
Expand All @@ -504,7 +504,7 @@ protected function compileSingleResultRow($row, $headerOnly = 0)
}
}
$title = $this->linkPageATagWrap(
htmlspecialchars($title),
$title,
$this->linkPage($row['data_page_id'], $row, $markUpSwParams)
);
}
Expand Down Expand Up @@ -1636,11 +1636,17 @@ protected function preparePageLink(int $pageUid, array $row, array $urlParameter
*/
protected function linkPageATagWrap(string $linkText, array $linkData): string
{
$target = !empty($linkData['target']) ? 'target="' . htmlspecialchars($linkData['target']) . '"' : '';

return '<a href="' . htmlspecialchars($linkData['uri']) . '" ' . $target . '>'
. htmlspecialchars($linkText)
. '</a>';
$attributes = [
'href' => $linkData['uri']
];
if (!empty($linkData['target'])) {
$attributes['target'] = $linkData['target'];
}
return sprintf(
'<a %s>%s</a>',
GeneralUtility::implodeAttributes($attributes, true),
htmlspecialchars($linkText, ENT_QUOTES | ENT_HTML5)
);
}

/**
Expand Down

0 comments on commit 213c3d3

Please sign in to comment.