Merge pull request #6904 from MrPetovan/bug/6901-autolinker-fix-punctuation-domain

Exclude punctuation from domain in autolinker regular expression
This commit is contained in:
Tobias Diekershoff 2019-03-18 06:07:11 +01:00 committed by GitHub
commit d32105aa8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -361,7 +361,10 @@ class Strings
( # Capture 1: entire matched URL
https?:// # http or https protocol
(?:
[^/\s.][^/\s]+[.][^\s/]+/? # looks like domain name followed by a slash
[^/\s`!()\[\]{};:\'",<>?«»“”‘’.] # Domain can\'t start with a .
[^/\s`!()\[\]{};:\'",<>?«»“”‘’]+ # Domain can\'t end with a .
\.
[^/\s`!()\[\]{};:\'".,<>?«»“”‘’]+/? # Followed by a slash
)
(?: # One or more:
[^\s()<>]+ # Run of non-space, non-()<>

View File

@ -102,6 +102,10 @@ class BBCodeTest extends MockedTest
'data' => "http://example.com\ntest",
'assertHTML' => false
],
'bug-6901' => [
'data' => "http://example.com<ul>",
'assertHTML' => false
],
];
}