Skip to content

Commit

Permalink
refactor: remove url encoding for guzzle uri implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasmus Schmidt committed Aug 12, 2024
1 parent a9e742b commit bdc511a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions Classes/Converter/Mailto2HrefObfuscatingConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ public function convert($mailAddress)
*/
protected function encryptEmail(string $string, int $randomOffset): string
{
// Decode HTML entities to ensure & is not encoded as &
$string = html_entity_decode($string, ENT_QUOTES | ENT_HTML5);

$out = '';
// like str_rot13() but with a variable offset and a wider character range
$len = strlen($string);
Expand Down
5 changes: 3 additions & 2 deletions Classes/Fusion/ConvertEmailLinksImplementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ public function convertLinkName(array $matches)
*/
public function convertMailLink($matches)
{
$email = trim($matches[2]);
$email = html_entity_decode(trim($matches[2]), ENT_QUOTES | ENT_HTML5);
$replacedHrefContent = $this->mailToHrefConverter->convert($email);

return $matches[1] . htmlspecialchars($replacedHrefContent);
$uri = new \GuzzleHttp\Psr7\Uri($replacedHrefContent);
return $matches[1] . (string)$uri;
}
}

0 comments on commit bdc511a

Please sign in to comment.