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

Commit

Permalink
add support for both http and https site urls
Browse files Browse the repository at this point in the history
  • Loading branch information
aksentyev committed Feb 5, 2020
1 parent e246bf2 commit d78bf2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ var uastrings = []struct {
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)",
expected: "Mozilla:5.0 Browser:AdsBot-Google-Mobile Bot:true Mobile:true",
},
{
title: "APIs-Google",
ua: "APIs-Google (+https://developers.google.com/webmasters/APIs-Google.html)",
expected: "Browser:APIs-Google Bot:true Mobile:false",
},

// Internet Explorer
{
Expand Down
2 changes: 1 addition & 1 deletion bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
)

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

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

0 comments on commit d78bf2c

Please sign in to comment.