Skip to content

Commit

Permalink
[TASK] Allow mailto-Links to begin with whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-K authored and Soeren Rohweder committed Jun 6, 2016
1 parent c40c459 commit bd2e941
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function evaluate() {
* @return string
*/
public function convertLinkName(array $matches) {
$replacedEmail = $this->linkNameConverter->convert($matches[2]);
$replacedEmail = $this->linkNameConverter->convert(trim($matches[2]));
return $matches[1] . $replacedEmail;
}

Expand All @@ -92,7 +92,7 @@ public function convertLinkName(array $matches) {
* @return string
*/
public function convertMailLink($matches) {
$email = $matches[2];
$email = trim($matches[2]);
$replacedHrefContent = $this->mailToHrefConverter->convert($email);
return $matches[1] . htmlspecialchars($replacedHrefContent);
}
Expand Down
4 changes: 4 additions & 0 deletions Tests/Unit/TypoScript/ConvertEmailLinksImplementationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public function emailTexts() {
'email address outside of link' => array(
'Email [email protected] should not be replaced',
'Email [email protected] should not be replaced'
),
'email address with space at the beginning' => array(
'Email <a href="mailto: [email protected]">[email protected]</a>',
'Email <a href="javascript:linkTo_UnCryptMailto(\'ithiOtmpbeat-rdb\', -15)">test (at) example.com</a>'
)
);
}
Expand Down

0 comments on commit bd2e941

Please sign in to comment.