Skip to content

Commit

Permalink
enforce https
Browse files Browse the repository at this point in the history
  • Loading branch information
azimut committed Sep 9, 2021
1 parent bb1f7e8 commit 7e63656
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/twitter/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ func EffectiveUrl(rawUrl string) (string, error) {
if err != nil {
return "", err
}
uri.RawQuery = ""
if uri.Host == "m.twitter.com" || uri.Host == "mobile.twitter.com" || uri.Host == "t.co" {
uri.Host = "twitter.com"
}
if uri.Host != "twitter.com" {
return "", errors.New("invalid hostname")
}
uri.RawQuery = ""
uri.Scheme = "https"
return prefix + uri.String(), nil
}

0 comments on commit 7e63656

Please sign in to comment.