File tree 2 files changed +11
-1
lines changed 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,15 @@ describe(fromUrl.name, () => {
66
66
expect ( fromUrl ( "1:2:3:4:5:6:7:8" ) ) . toBe ( "[1:2:3:4:5:6:7:8]" ) ;
67
67
} ) ;
68
68
69
+ // https://github.com/peerigon/parse-domain/issues/140
70
+ test ( "it doesn't get confused with other : characters" , ( ) => {
71
+ expect (
72
+ fromUrl (
73
+ "http://www.example.com/search?updated-max=2020-04-16T09:14:00+10:00"
74
+ )
75
+ ) . toBe ( "www.example.com" ) ;
76
+ } ) ;
77
+
69
78
test ( "it returns the NO_HOSTNAME symbol for invalid URLs" , ( ) => {
70
79
expect ( fromUrl ( ":8080/path?query" ) ) . toBe ( NO_HOSTNAME ) ;
71
80
expect ( fromUrl ( "/path?query" ) ) . toBe ( NO_HOSTNAME ) ;
Original file line number Diff line number Diff line change 1
1
const urlPattern = / ^ [ a - z ] [ * + . a - z - ] + : \/ \/ / i;
2
- const invalidIpv6Pattern = / ^ ( [ a - z ] [ * + . a - z - ] + : \/ \/ ) ( [ ^ [ ] .* : [ ^ / ? ] * : [ ^ / ? ] * ) ( .* ) / i;
2
+ const invalidIpv6Pattern =
3
+ / ^ ( [ a - z ] [ * + . a - z - ] + : \/ \/ ) ( [ ^ [ ] [ ^ / ? ] * : [ ^ / ? ] * : [ ^ / ? ] * ) ( .* ) / i;
3
4
4
5
export const NO_HOSTNAME : unique symbol = Symbol ( "NO_HOSTNAME" ) ;
5
6
You can’t perform that action at this time.
0 commit comments