[MM-63455] Fix Link previews with brackets when making the request (#30507)
* allow opening angle bracket before links * cut off link before an angle bracket(both open & close) * add more test cases for ParseURLAutolink func * add more test cases for ParseWWWAutolink func * add more test cases for TrimTrailingCharactersFromLink func * add more test cases for GetFirstLinkAndImages func * add test cases for isAllowedBeforeWWWLink func * allow closing angle bracket and opening paranthesis before links --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fb301d8b0a
Коммит
62753a1481
@@ -58,7 +58,7 @@ func parseWWWAutolink(data string, position int) (Range, bool) {
|
||||
|
||||
func isAllowedBeforeWWWLink(c byte) bool {
|
||||
switch c {
|
||||
case '*', '_', '~', ')':
|
||||
case '*', '_', '~', ')', '<', '(', '>':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -174,9 +174,9 @@ func trimTrailingCharactersFromLink(markdown string, start int, end int) int {
|
||||
runes := []rune(markdown[start:end])
|
||||
linkEnd := len(runes)
|
||||
|
||||
// Cut off the link before an open angle bracket if it contains one
|
||||
// Cut off the link before an angle bracket if it contains one
|
||||
for i, c := range runes {
|
||||
if c == '<' {
|
||||
if c == '<' || c == '>' {
|
||||
linkEnd = i
|
||||
break
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user