-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Hey,
While upgrading to the 0.4.12 version, I noticed that the feature introduced in #366 specifically in commit ba04564
The problem appears at this line: ba04564#diff-4431759fdf270c83e7713adcd0cf7d5aR52
We use URL.Parse()
on a domain which does not create an error but returns an empty string when calling Hostname()
afterwards.
I would suggest to either rename the parameter GitlabHostname to GitlabURL and use a URL from now on or jsut before calling the URL parse, format the string to contain the scheme so that we can parse it correctly.
I would also add a unit test to verify that this continue to work in the future.
@lkysow I would gladly submit a PR for this issue once we have worked out what's the best solution if that's ok with you.
P.S.: Here is an example code to reproduce the issue:
package main
import (
"fmt"
"log"
"net/url"
)
func main() {
u, err := url.Parse("https://example.org")
if err != nil {
log.Fatal(err)
}
fmt.Println(u.Hostname())
u, err = url.Parse("example.org")
if err != nil {
log.Fatal(err)
}
fmt.Println(u.Hostname())
}
Output:
example.org