diff --git a/typo3/sysext/core/Classes/DataHandling/SoftReference/UrlSoftReferenceParser.php b/typo3/sysext/core/Classes/DataHandling/SoftReference/UrlSoftReferenceParser.php index 1ba8ab2cde43aa5d3f3e91ab3819153eb5166b99..32cc7fb3e6f8b3346b0f05ef294f7970dac70e23 100644 --- a/typo3/sysext/core/Classes/DataHandling/SoftReference/UrlSoftReferenceParser.php +++ b/typo3/sysext/core/Classes/DataHandling/SoftReference/UrlSoftReferenceParser.php @@ -22,7 +22,7 @@ namespace TYPO3\CMS\Core\DataHandling\SoftReference; */ class UrlSoftReferenceParser extends AbstractSoftReferenceParser { - protected const REGEXP = '/([\s\'"]+)((https?|ftp):\\/\\/(?:[!#$&-;=?-\[\]_a-z~]+|%[0-9a-fA-F]{2})+)([\s\'"])?/'; + protected const REGEXP = '/([^[:alnum:]"\']+)((https?|ftp):\\/\\/(?:[!#$&-;=?-\[\]_a-z~]+|%[0-9a-fA-F]{2})+)([[:space:]])?/'; public function parse(string $table, string $field, int $uid, string $content, string $structurePath = ''): SoftReferenceParserResult { diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/UrlSoftReferenceParserTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/UrlSoftReferenceParserTest.php index 142d7d0de1e4708515484560a7dc00f1846d1b47..f44cc347166d000f09539e516653ee9b7c8320a5 100644 --- a/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/UrlSoftReferenceParserTest.php +++ b/typo3/sysext/core/Tests/Unit/DataHandling/SoftReference/UrlSoftReferenceParserTest.php @@ -46,10 +46,10 @@ class UrlSoftReferenceParserTest extends AbstractSoftReferenceParserTest ], ], ], - 'URLs in html match' => [ - '<a href="https://foo-bar.baz">foo</a>', + 'URLs in content match' => [ + 'Lorem ipsum https://foo-bar.baz dolor sit', [ - 'content' => '<a href="https://foo-bar.baz">foo</a>', + 'content' => 'Lorem ipsum https://foo-bar.baz dolor sit', 'elements' => [ 2 => [ 'matchString' => 'https://foo-bar.baz', @@ -101,6 +101,15 @@ class UrlSoftReferenceParserTest extends AbstractSoftReferenceParserTest ], ], ], + // The two cases below are handled by typolink_tag + 'URLs in anchor tag attributes do NOT match' => [ + '<a href="https://foo-bar.baz">some link</a>', + null, + ], + 'URLs in link tag attributes do NOT match' => [ + '<link href="https://foo-bar.baz/style.css" rel="stylesheet">', + null, + ], ]; } diff --git a/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php b/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php index 4fdb0e36802e8f3f54bc54b7b6ee7e2dffb89928..e6209b0e351c7320952eb886e204508af2f5ee44 100644 --- a/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php +++ b/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php @@ -329,7 +329,7 @@ class LinkAnalyzer } // Traverse soft references // set subst such that findRef will return substitutes for urls, emails etc - $softRefParams = ['subst' => true]; + $softRefParams = ['subst']; foreach ($this->softReferenceParserFactory->getParsersBySoftRefParserList($conf['softref'], $softRefParams) as $softReferenceParser) { $parserResult = $softReferenceParser->parse($table, $field, $idRecord, $valueField); if (!$parserResult->hasMatched()) {