aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/mvdan.cc/xurls/v2/xurls.go
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2019-10-14 02:38:15 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2019-10-14 08:38:15 +0800
commitba201aaa44b19f633fab0c4682d5f97558b3205e (patch)
treeb7fd1833c37158c2db27dc1158fd58fe1557002b /vendor/mvdan.cc/xurls/v2/xurls.go
parent15809d81f7d36759f289b941352a9754611c5dba (diff)
downloadgitea-ba201aaa44b19f633fab0c4682d5f97558b3205e.tar.gz
gitea-ba201aaa44b19f633fab0c4682d5f97558b3205e.zip
vendor: update mvdan.cc/xurls/v2 to v2.1.0 (#8495)
Diffstat (limited to 'vendor/mvdan.cc/xurls/v2/xurls.go')
-rw-r--r--vendor/mvdan.cc/xurls/v2/xurls.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/vendor/mvdan.cc/xurls/v2/xurls.go b/vendor/mvdan.cc/xurls/v2/xurls.go
index d6279ae60b..7244c709a0 100644
--- a/vendor/mvdan.cc/xurls/v2/xurls.go
+++ b/vendor/mvdan.cc/xurls/v2/xurls.go
@@ -19,9 +19,9 @@ const (
iriChar = letter + mark + number
currency = `\p{Sc}`
otherSymb = `\p{So}`
- endChar = iriChar + `/\-+_&~*%=#` + currency + otherSymb
+ endChar = iriChar + `/\-+&~%=#` + currency + otherSymb
otherPunc = `\p{Po}`
- midChar = endChar + `|` + otherPunc
+ midChar = endChar + "_*" + otherPunc
wellParen = `\([` + midChar + `]*(\([` + midChar + `]*\)[` + midChar + `]*)*\)`
wellBrack = `\[[` + midChar + `]*(\[[` + midChar + `]*\][` + midChar + `]*)*\]`
wellBrace = `\{[` + midChar + `]*(\{[` + midChar + `]*\}[` + midChar + `]*)*\}`
@@ -72,9 +72,11 @@ func strictExp() string {
}
func relaxedExp() string {
- site := domain + `(?i)` + anyOf(append(TLDs, PseudoTLDs...)...) + `(?-i)`
+ punycode := `xn--[a-z0-9-]+`
+ knownTLDs := anyOf(append(TLDs, PseudoTLDs...)...)
+ site := domain + `(?i)(` + punycode + `|` + knownTLDs + `)(?-i)`
hostName := `(` + site + `|` + ipAddr + `)`
- webURL := hostName + port + `(/|/` + pathCont + `?|\b|$)`
+ webURL := hostName + port + `(/|/` + pathCont + `?|\b|(?m)$)`
return strictExp() + `|` + webURL
}