Skip to content

Commit 862be19

Browse files
committed
fix: allow whole repository url on form
Signed-off-by: Carlos Alexandro Becker <[email protected]>
1 parent 1f21ac4 commit 862be19

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

controller/index.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io"
66
"io/fs"
77
"net/http"
8+
"strings"
89

910
"github.com/caarlos0/httperr"
1011
)
@@ -17,7 +18,8 @@ func Index(fsys fs.FS, version string) http.Handler {
1718

1819
func HandleForm(fsys fs.FS) http.HandlerFunc {
1920
return func(w http.ResponseWriter, r *http.Request) {
20-
http.Redirect(w, r, "/"+r.FormValue("repository"), http.StatusSeeOther)
21+
repo := strings.TrimPrefix(r.FormValue("repository"), "https://github.com/")
22+
http.Redirect(w, r, repo, http.StatusSeeOther)
2123
}
2224
}
2325

0 commit comments

Comments
 (0)