Skip to content
This repository was archived by the owner on Feb 17, 2023. It is now read-only.

Commit d78bf2c

Browse files
committed
add support for both http and https site urls
1 parent e246bf2 commit d78bf2c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

all_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ var uastrings = []struct {
104104
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1 (compatible; AdsBot-Google-Mobile; +http://www.google.com/mobile/adsbot.html)",
105105
expected: "Mozilla:5.0 Browser:AdsBot-Google-Mobile Bot:true Mobile:true",
106106
},
107+
{
108+
title: "APIs-Google",
109+
ua: "APIs-Google (+https://developers.google.com/webmasters/APIs-Google.html)",
110+
expected: "Browser:APIs-Google Bot:true Mobile:false",
111+
},
107112

108113
// Internet Explorer
109114
{

bot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010
)
1111

12-
var botFromSiteRegexp = regexp.MustCompile("http://.+\\.\\w+")
12+
var botFromSiteRegexp = regexp.MustCompile("http[s]?://.+\\.\\w+")
1313

1414
// Get the name of the bot from the website that may be in the given comment. If
1515
// there is no website in the comment, then an empty string is returned.

0 commit comments

Comments
 (0)