handle .git in RSS URLs and add missing returns

This commit is contained in:
Amolith 2023-10-28 23:40:07 -04:00
parent 67b88eafd3
commit 3612ffc595
Signed by: Amolith
GPG Key ID: 8AE30347CE28D101
1 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,7 @@ func (h Handler) NewHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
return
} }
proj := project.Project{ proj := project.Project{
@ -96,6 +97,11 @@ func (h Handler) NewHandler(w http.ResponseWriter, r *http.Request) {
Name: name, Name: name,
Forge: forge, Forge: forge,
} }
if strings.HasSuffix(proj.URL, ".git") {
proj.URL = proj.URL[:len(proj.URL)-4]
}
proj, err := project.GetReleases(h.DbConn, proj) proj, err := project.GetReleases(h.DbConn, proj)
if err != nil { if err != nil {
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
@ -103,6 +109,7 @@ func (h Handler) NewHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
return
} }
tmpl := template.Must(template.ParseFS(fs, "static/select-release.html")) tmpl := template.Must(template.ParseFS(fs, "static/select-release.html"))
if err := tmpl.Execute(w, proj); err != nil { if err := tmpl.Execute(w, proj); err != nil {
@ -116,6 +123,7 @@ func (h Handler) NewHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
return
} }
project.Untrack(h.DbConn, h.ManualRefresh, submittedURL) project.Untrack(h.DbConn, h.ManualRefresh, submittedURL)
@ -246,6 +254,7 @@ func (h Handler) LogoutHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
return
} }
cookie.MaxAge = -1 cookie.MaxAge = -1
http.SetCookie(w, cookie) http.SetCookie(w, cookie)