Skip to content

Commit ba201aa

Browse files
sapklunny
authored andcommitted
vendor: update mvdan.cc/xurls/v2 to v2.1.0 (#8495)
1 parent 15809d8 commit ba201aa

File tree

9 files changed

+51
-46
lines changed

9 files changed

+51
-46
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ require (
120120
gopkg.in/src-d/go-git.v4 v4.13.1
121121
gopkg.in/stretchr/testify.v1 v1.2.2 // indirect
122122
gopkg.in/testfixtures.v2 v2.5.0
123-
mvdan.cc/xurls/v2 v2.0.0
123+
mvdan.cc/xurls/v2 v2.1.0
124124
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
125125
xorm.io/builder v0.3.6
126126
xorm.io/core v0.7.2

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -812,8 +812,8 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
812812
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
813813
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
814814
honnef.co/go/tools v0.0.1-2019.2.2/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
815-
mvdan.cc/xurls/v2 v2.0.0 h1:r1zSOSNS/kqtpmATyMMMvaZ4/djsesbYz5kr0+qMRWc=
816-
mvdan.cc/xurls/v2 v2.0.0/go.mod h1:2/webFPYOXN9jp/lzuj0zuAVlF+9g4KPFJANH1oJhRU=
815+
mvdan.cc/xurls/v2 v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=
816+
mvdan.cc/xurls/v2 v2.1.0/go.mod h1:5GrSd9rOnKOpZaji1OZLYL/yeAAtGDlo/cFe+8K5n8E=
817817
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
818818
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 h1:mUcz5b3FJbP5Cvdq7Khzn6J9OCUQJaBwgBkCR+MOwSs=
819819
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:FJGmPh3vz9jSos1L/F91iAgnC/aejc0wIIrF2ZwJxdY=

vendor/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ gopkg.in/testfixtures.v2
610610
gopkg.in/warnings.v0
611611
# gopkg.in/yaml.v2 v2.2.2
612612
gopkg.in/yaml.v2
613-
# mvdan.cc/xurls/v2 v2.0.0
613+
# mvdan.cc/xurls/v2 v2.1.0
614614
mvdan.cc/xurls/v2
615615
# strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
616616
strk.kbt.io/projects/go/libravatar

vendor/mvdan.cc/xurls/v2/.travis.yml

-17
This file was deleted.

vendor/mvdan.cc/xurls/v2/README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
# xurls
22

33
[![GoDoc](https://godoc.org/mvdan.cc/xurls?status.svg)](https://godoc.org/mvdan.cc/xurls)
4-
[![Travis](https://travis-ci.org/mvdan/xurls.svg?branch=master)](https://travis-ci.org/mvdan/xurls)
54

6-
Extract urls from text using regular expressions. Requires Go 1.10.3 or later.
5+
Extract urls from text using regular expressions. Requires Go 1.12 or later.
76

87
```go
98
import "mvdan.cc/xurls/v2"
109

1110
func main() {
12-
xurls.Relaxed().FindString("Do gophers live in golang.org?")
13-
// "golang.org"
14-
xurls.Strict().FindAllString("foo.com is http://foo.com/.", -1)
15-
// []string{"http://foo.com/"}
11+
rxRelaxed := xurls.Relaxed()
12+
rxRelaxed.FindString("Do gophers live in golang.org?") // "golang.org"
13+
rxRelaxed.FindString("This string does not have a URL") // ""
14+
15+
rxStrict := xurls.Strict()
16+
rxStrict.FindAllString("must have scheme: http://foo.com/.", -1) // []string{"http://foo.com/"}
17+
rxStrict.FindAllString("no scheme, no match: foo.com", -1) // []string{}
1618
}
1719
```
1820

1921
Note that the funcs compile regexes, so avoid calling them repeatedly.
2022

2123
#### cmd/xurls
2224

23-
go get -u mvdan.cc/xurls/v2/cmd/xurls
25+
To install the tool globally:
26+
27+
go get mvdan.cc/xurls/cmd/xurls
2428

2529
```shell
2630
$ echo "Do gophers live in http://golang.org?" | xurls

vendor/mvdan.cc/xurls/v2/go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
module mvdan.cc/xurls/v2
2+
3+
go 1.13

vendor/mvdan.cc/xurls/v2/schemes.go

+23
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ var Schemes = []string{
1212
`about`,
1313
`acap`,
1414
`acct`,
15+
`acd`,
1516
`acr`,
1617
`adiumxtra`,
18+
`adt`,
1719
`afp`,
1820
`afs`,
1921
`aim`,
22+
`amss`,
23+
`android`,
2024
`appdata`,
2125
`apt`,
26+
`ark`,
2227
`attachment`,
2328
`aw`,
2429
`barion`,
@@ -28,8 +33,11 @@ var Schemes = []string{
2833
`blob`,
2934
`bolo`,
3035
`browserext`,
36+
`calculator`,
3137
`callto`,
3238
`cap`,
39+
`cast`,
40+
`casts`,
3341
`chrome`,
3442
`chrome-extension`,
3543
`cid`,
@@ -44,6 +52,7 @@ var Schemes = []string{
4452
`conti`,
4553
`crid`,
4654
`cvs`,
55+
`dab`,
4756
`data`,
4857
`dav`,
4958
`diaspora`,
@@ -54,6 +63,9 @@ var Schemes = []string{
5463
`dlna-playsingle`,
5564
`dns`,
5665
`dntp`,
66+
`dpp`,
67+
`drm`,
68+
`drop`,
5769
`dtn`,
5870
`dvb`,
5971
`ed2k`,
@@ -66,8 +78,11 @@ var Schemes = []string{
6678
`file`,
6779
`filesystem`,
6880
`finger`,
81+
`first-run-pen-experience`,
6982
`fish`,
83+
`fm`,
7084
`ftp`,
85+
`fuchsia-pkg`,
7186
`geo`,
7287
`gg`,
7388
`git`,
@@ -112,6 +127,8 @@ var Schemes = []string{
112127
`lastfm`,
113128
`ldap`,
114129
`ldaps`,
130+
`leaptofrogans`,
131+
`lorawan`,
115132
`lvlt`,
116133
`magnet`,
117134
`mailserver`,
@@ -129,9 +146,11 @@ var Schemes = []string{
129146
`moz`,
130147
`ms-access`,
131148
`ms-browser-extension`,
149+
`ms-calculator`,
132150
`ms-drive-to`,
133151
`ms-enrollment`,
134152
`ms-excel`,
153+
`ms-eyecontrolspeech`,
135154
`ms-gamebarservices`,
136155
`ms-gamingoverlay`,
137156
`ms-getoffice`,
@@ -141,6 +160,7 @@ var Schemes = []string{
141160
`ms-lockscreencomponent-config`,
142161
`ms-media-stream-id`,
143162
`ms-mixedrealitycapture`,
163+
`ms-mobileplans`,
144164
`ms-officeapp`,
145165
`ms-people`,
146166
`ms-project`,
@@ -186,6 +206,7 @@ var Schemes = []string{
186206
`msnim`,
187207
`msrp`,
188208
`msrps`,
209+
`mss`,
189210
`mtqp`,
190211
`mumble`,
191212
`mupdate`,
@@ -205,6 +226,7 @@ var Schemes = []string{
205226
`pack`,
206227
`palm`,
207228
`paparazzi`,
229+
`payto`,
208230
`pkcs11`,
209231
`platform`,
210232
`pop`,
@@ -213,6 +235,7 @@ var Schemes = []string{
213235
`proxy`,
214236
`pwid`,
215237
`psyc`,
238+
`pttp`,
216239
`qb`,
217240
`query`,
218241
`redis`,

vendor/mvdan.cc/xurls/v2/tlds.go

+5-14
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var TLDs = []string{
2424
`accountant`,
2525
`accountants`,
2626
`aco`,
27-
`active`,
2827
`actor`,
2928
`ad`,
3029
`adac`,
@@ -154,7 +153,6 @@ var TLDs = []string{
154153
`bj`,
155154
`black`,
156155
`blackfriday`,
157-
`blanco`,
158156
`blockbuster`,
159157
`blog`,
160158
`bloomberg`,
@@ -163,7 +161,6 @@ var TLDs = []string{
163161
`bms`,
164162
`bmw`,
165163
`bn`,
166-
`bnl`,
167164
`bnpparibas`,
168165
`bo`,
169166
`boats`,
@@ -307,6 +304,7 @@ var TLDs = []string{
307304
`coupon`,
308305
`coupons`,
309306
`courses`,
307+
`cpa`,
310308
`cr`,
311309
`credit`,
312310
`creditcard`,
@@ -370,7 +368,6 @@ var TLDs = []string{
370368
`doctor`,
371369
`dodge`,
372370
`dog`,
373-
`doha`,
374371
`domains`,
375372
`dot`,
376373
`download`,
@@ -379,7 +376,6 @@ var TLDs = []string{
379376
`dubai`,
380377
`duck`,
381378
`dunlop`,
382-
`duns`,
383379
`dupont`,
384380
`durban`,
385381
`dvag`,
@@ -400,7 +396,6 @@ var TLDs = []string{
400396
`engineer`,
401397
`engineering`,
402398
`enterprises`,
403-
`epost`,
404399
`epson`,
405400
`equipment`,
406401
`er`,
@@ -496,6 +491,7 @@ var TLDs = []string{
496491
`games`,
497492
`gap`,
498493
`garden`,
494+
`gay`,
499495
`gb`,
500496
`gbiz`,
501497
`gd`,
@@ -588,7 +584,6 @@ var TLDs = []string{
588584
`homes`,
589585
`homesense`,
590586
`honda`,
591-
`honeywell`,
592587
`horse`,
593588
`hospital`,
594589
`host`,
@@ -642,7 +637,6 @@ var TLDs = []string{
642637
`ir`,
643638
`irish`,
644639
`is`,
645-
`iselect`,
646640
`ismaili`,
647641
`ist`,
648642
`istanbul`,
@@ -752,6 +746,7 @@ var TLDs = []string{
752746
`lixil`,
753747
`lk`,
754748
`llc`,
749+
`llp`,
755750
`loan`,
756751
`loans`,
757752
`locker`,
@@ -827,7 +822,6 @@ var TLDs = []string{
827822
`mo`,
828823
`mobi`,
829824
`mobile`,
830-
`mobily`,
831825
`moda`,
832826
`moe`,
833827
`moi`,
@@ -1161,21 +1155,19 @@ var TLDs = []string{
11611155
`sony`,
11621156
`soy`,
11631157
`space`,
1164-
`spiegel`,
11651158
`sport`,
11661159
`spot`,
11671160
`spreadbetting`,
11681161
`sr`,
11691162
`srl`,
11701163
`srt`,
1164+
`ss`,
11711165
`st`,
11721166
`stada`,
11731167
`staples`,
11741168
`star`,
1175-
`starhub`,
11761169
`statebank`,
11771170
`statefarm`,
1178-
`statoil`,
11791171
`stc`,
11801172
`stcgroup`,
11811173
`stockholm`,
@@ -1391,7 +1383,6 @@ var TLDs = []string{
13911383
`zara`,
13921384
`zero`,
13931385
`zip`,
1394-
`zippo`,
13951386
`zm`,
13961387
`zone`,
13971388
`zuerich`,
@@ -1449,7 +1440,7 @@ var TLDs = []string{
14491440
`كوم`,
14501441
`مصر`,
14511442
`مليسيا`,
1452-
`موبايلي`,
1443+
`موريتانيا`,
14531444
`موقع`,
14541445
`همراه`,
14551446
`پاكستان`,

vendor/mvdan.cc/xurls/v2/xurls.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ const (
1919
iriChar = letter + mark + number
2020
currency = `\p{Sc}`
2121
otherSymb = `\p{So}`
22-
endChar = iriChar + `/\-+_&~*%=#` + currency + otherSymb
22+
endChar = iriChar + `/\-+&~%=#` + currency + otherSymb
2323
otherPunc = `\p{Po}`
24-
midChar = endChar + `|` + otherPunc
24+
midChar = endChar + "_*" + otherPunc
2525
wellParen = `\([` + midChar + `]*(\([` + midChar + `]*\)[` + midChar + `]*)*\)`
2626
wellBrack = `\[[` + midChar + `]*(\[[` + midChar + `]*\][` + midChar + `]*)*\]`
2727
wellBrace = `\{[` + midChar + `]*(\{[` + midChar + `]*\}[` + midChar + `]*)*\}`
@@ -72,9 +72,11 @@ func strictExp() string {
7272
}
7373

7474
func relaxedExp() string {
75-
site := domain + `(?i)` + anyOf(append(TLDs, PseudoTLDs...)...) + `(?-i)`
75+
punycode := `xn--[a-z0-9-]+`
76+
knownTLDs := anyOf(append(TLDs, PseudoTLDs...)...)
77+
site := domain + `(?i)(` + punycode + `|` + knownTLDs + `)(?-i)`
7678
hostName := `(` + site + `|` + ipAddr + `)`
77-
webURL := hostName + port + `(/|/` + pathCont + `?|\b|$)`
79+
webURL := hostName + port + `(/|/` + pathCont + `?|\b|(?m)$)`
7880
return strictExp() + `|` + webURL
7981
}
8082

0 commit comments

Comments
 (0)