File tree 2 files changed +3
-2
lines changed
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -593,6 +593,7 @@ mod tests {
593
593
fn test_is_external_link ( ) {
594
594
assert ! ( is_external_link( "http://example.com/" ) ) ;
595
595
assert ! ( is_external_link( "https://example.com/" ) ) ;
596
+ assert ! ( is_external_link( "www.example.com" ) ) ;
596
597
assert ! ( is_external_link( "https://example.com/index.html#introduction" ) ) ;
597
598
598
599
assert ! ( !is_external_link
( "mailto:[email protected] " ) ) ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pub fn port_is_available(port: u16) -> bool {
10
10
TcpListener :: bind ( ( "127.0.0.1" , port) ) . is_ok ( )
11
11
}
12
12
13
- /// Returns whether a link starts with an HTTP(s) scheme.
13
+ /// Returns whether a link starts with an HTTP(s) scheme or "www." .
14
14
pub fn is_external_link ( link : & str ) -> bool {
15
- link. starts_with ( "http:" ) || link. starts_with ( "https:" )
15
+ link. starts_with ( "http:" ) || link. starts_with ( "https:" ) || link . starts_with ( "www." )
16
16
}
You can’t perform that action at this time.
0 commit comments