mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-19 05:47:28 -06:00
[chore] Review comments
This commit is contained in:
parent
5155718bcb
commit
77a33f6fb0
4 changed files with 7 additions and 7 deletions
|
|
@ -375,7 +375,7 @@ func (f *Filter) errantLinks(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find + parse every http/https link in the status.
|
// Find + parse every http/https link in the status.
|
||||||
rawLinks := regexes.URL.FindAllString(concat, -1)
|
rawLinks := regexes.URLLike.FindAllString(concat, -1)
|
||||||
links := make([]preppedLink, 0, len(rawLinks))
|
links := make([]preppedLink, 0, len(rawLinks))
|
||||||
for _, rawLink := range rawLinks {
|
for _, rawLink := range rawLinks {
|
||||||
linkURI, err := url.Parse(rawLink)
|
linkURI, err := url.Parse(rawLink)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"mvdan.cc/xurls/v2"
|
xurls "mvdan.cc/xurls/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -78,9 +78,9 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// URL captures anything that looks like a URL. This includes
|
// URLLike captures anything that resembles a URL. This includes URLs
|
||||||
// URLs without a scheme, based on a built-in list of TLDs.
|
// with or without a scheme, and emails.
|
||||||
URL = xurls.Relaxed()
|
URLLike = xurls.Relaxed()
|
||||||
|
|
||||||
// MentionName captures the username and domain part from
|
// MentionName captures the username and domain part from
|
||||||
// a mention string such as @whatever_user@example.org,
|
// a mention string such as @whatever_user@example.org,
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ func (f *Formatter) fromMarkdown(
|
||||||
},
|
},
|
||||||
// Turns URLs into links.
|
// Turns URLs into links.
|
||||||
extension.NewLinkify(
|
extension.NewLinkify(
|
||||||
extension.WithLinkifyURLRegexp(regexes.URL),
|
extension.WithLinkifyURLRegexp(regexes.URLLike),
|
||||||
),
|
),
|
||||||
extension.Strikethrough,
|
extension.Strikethrough,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ func (f *Formatter) fromPlain(
|
||||||
},
|
},
|
||||||
// Turns URLs into links.
|
// Turns URLs into links.
|
||||||
extension.NewLinkify(
|
extension.NewLinkify(
|
||||||
extension.WithLinkifyURLRegexp(regexes.URL),
|
extension.WithLinkifyURLRegexp(regexes.URLLike),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue