Bug #28248
closedt3lib_div::substUrlsInPlainText didn't recognize URLs at the end of a sentence correctly
100%
Description
e.g.
To unsubscribe use http://unsubscribe.com.
detects "http://unsubscribe.com." as URL.
I've shortened the substUrlsInPlainText function:
function substUrlsInPlainText($message,$urlmode='76',$index_script_url='') {
return preg_replace('/(http|https):\/\/.+(?=[\]\.\?]*([\! \'"()<>]+|$))/eiU','self::makeRedirectUrl("\\0",'.intval($urlmode).',"'.$index_script_url.'")',$message);
}
The regex:
(http|https):\/\/.+ -> Everything which starts with http:// or https://
(?=[\]\.\?]* -> and not end with "]", "." or "?" (these are also allowed in the url)
([\! \'"()<>]+|$)) -> and end with one of these is an url...
I've checked this with the following messages:
'http://only-url.com',
'https://only-secure-url.com',
'A http://url in the sentence.',
'URL in round brackets (http://www.example.com) in the sentence.',
'URL in square brackets [http://www.example.com/a/b.php?c[d]=e] in the sentence.',
'URL in square brackets at the end of the sentence [http://www.example.com/a/b.php?c[d]=e].',
'Square brackets in the http://www.url.com?tt_news[uid]=1',
'URL with http://dot.com.',
'URL in <a href="http://www.example.com/">a tag</a>',
'URL in HTML <b>http://www.example.com</b><br />',
'URL with http://username@example.com/',
'URL in quotation marks "http://example.com"',
'URL with umlauts http://müller.de',
'Secret in URL http://username:secret@example.com',
'Multiline
text with a http://url.com',
'http://www.shout.com!',
'And last but not least http://www.two.com/abc http://urls.com/abc?x=1&y=2',
Files
Updated by Mr. Hudson over 13 years ago
Patch set 1 of change Ic5cc35546602e1d626f88f2cd64b9030f31780d6 has been pushed to the review server.
It is available at http://review.typo3.org/3383
Updated by Mr. Hudson over 13 years ago
Patch set 2 of change Ic5cc35546602e1d626f88f2cd64b9030f31780d6 has been pushed to the review server.
It is available at http://review.typo3.org/3383
Updated by Tolleiv Nietsch over 13 years ago
- Status changed from New to Under Review
Updated by Gerrit Code Review almost 13 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/3383
Updated by Gerrit Code Review over 12 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/3383
Updated by Gerrit Code Review over 12 years ago
Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/10537
Updated by Gerrit Code Review over 12 years ago
Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/10538
Updated by Gerrit Code Review over 12 years ago
Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/10539
Updated by Robert Heel over 12 years ago
- Status changed from Under Review to Resolved
- % Done changed from 30 to 100
Applied in changeset 64d886acc619e20e49cc7bce391260ee5c8b65be.
Updated by Gerrit Code Review over 12 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at http://review.typo3.org/13103
Updated by Gerrit Code Review about 12 years ago
Patch set 2 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/10538
Updated by Robert Heel about 12 years ago
- Status changed from Under Review to Resolved
Applied in changeset 76d0b9c912deb650b76b8ce9b88f1c65cb13fe77.
Updated by Stig Nørgaard Færch about 11 years ago
I still have this problem with 4.5.29 and 4.5.30.