Problem: need url for login
All checks were successful
continuous-integration/drone/push Build is passing

Solution: create url when input does not parse
This commit is contained in:
Peter Stuifzand 2022-04-27 20:44:21 +02:00
parent b33cfeb395
commit f617dd973f

View File

@ -292,10 +292,14 @@ func (*authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
urlString := r.PostFormValue("url") urlString := r.PostFormValue("url")
u, err := url.Parse(urlString) u, err := url.Parse(urlString)
if err != nil {
urlString = fmt.Sprintf("https://%s/", urlString)
u, err = url.Parse(urlString)
if err != nil { if err != nil {
http.Error(w, err.Error(), 400) http.Error(w, err.Error(), 400)
return return
} }
}
endpoints, err := indieauth.GetEndpoints(u) endpoints, err := indieauth.GetEndpoints(u)
if err != nil { if err != nil {