[BUGFIX] Email links with parameters in LegacyLinkNotationConverter 02/52402/3
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Sat, 8 Apr 2017 23:06:55 +0000 (16:06 -0700)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 10 Apr 2017 20:59:57 +0000 (22:59 +0200)
Email addresses in link can have added query parameters to control
fields like the subject in the mail client.
Add a test to the LinkServiceTest for this case and add support for
this feature to the converter.

Change-Id: I06cbb2e12eace70825aac179d1af85227804ce39
Resolves: #80723
Releases: master
Reviewed-on: https://review.typo3.org/52402
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/LinkHandling/LegacyLinkNotationConverter.php
typo3/sysext/core/Tests/Unit/LinkHandling/LinkServiceTest.php

index 6d3bfae..48ca6e4 100644 (file)
@@ -62,7 +62,7 @@ class LegacyLinkNotationConverter
         // Resolve FAL-api "file:UID-of-sys_file-record" and "file:combined-identifier"
         if (stripos($linkParameter, 'file:') === 0) {
             $result = $this->getFileOrFolderObjectFromMixedIdentifier(substr($linkParameter, 5));
-        } elseif (GeneralUtility::validEmail($linkParameter)) {
+        } elseif (GeneralUtility::validEmail(parse_url($linkParameter, PHP_URL_PATH))) {
             $result['type'] = LinkService::TYPE_EMAIL;
             $result['email'] = $linkParameter;
         } elseif (strpos($linkParameter, ':') !== false) {
index 94abe0b..b7fed3d 100644 (file)
@@ -148,6 +148,14 @@ class LinkServiceTest extends UnitTestCase
                 ],
                 'mailto:one@love.com'
             ],
+            'email without protocol and subject parameter' => [
+                'email@mail.mail?subject=Anfrage:%20Text%20Text%20Lösungen',
+                [
+                    'type' => LinkService::TYPE_EMAIL,
+                    'email' => 'email@mail.mail?subject=Anfrage:%20Text%20Text%20Lösungen'
+                ],
+                'mailto:email@mail.mail?subject=Anfrage:%20Text%20Text%20Lösungen'
+            ],
             'current page - cool style' => [
                 't3://page?uid=current',
                 [