Skip to content

Commit 879e51e

Browse files
committed
Automatically add http:// to homepage URLs
1 parent 879d9bb commit 879e51e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/offer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import "errors"
66
import "github.com/licensezero/cli/data"
77
import "io/ioutil"
88
import "net/http"
9+
import "strings"
910

1011
// AgencyReference includes the text required in agency terms agreement statements to the API.
1112
const AgencyReference = "the agency terms at https://licensezero.com/terms/agency"
@@ -28,6 +29,9 @@ type offerResponse struct {
2829

2930
// Offer sends an offer API request.
3031
func Offer(licensor *data.Licensor, homepage, description string, private, relicense uint) (string, error) {
32+
if !strings.HasPrefix(homepage, "https://") && !strings.HasPrefix(homepage, "http://") {
33+
homepage = "http://" + homepage
34+
}
3135
bodyData := offerRequest{
3236
Action: "offer",
3337
LicensorID: licensor.LicensorID,

0 commit comments

Comments
 (0)