routing to pkg repository instead of _static

fixes issue #11

this allows users to go to the vcs page instead of always being routed
to _static

Change-Id: I09807fe229e04b2e82a13e62975e70ee6dc7bcca
This commit is contained in:
Derek McQuay 2016-06-28 22:42:55 -07:00 committed by sm
parent 733cb78284
commit 559cbd0132

View File

@ -58,7 +58,11 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if req.Method == "GET" {
req.ParseForm()
if _, ok := req.Form["go-get"]; !ok {
http.Redirect(w, req, prefix["static"], http.StatusTemporaryRedirect)
route := prefix["static"]
if p, err := s.db.Package(req.Host + req.URL.Path); err == nil {
route = p.Repo
}
http.Redirect(w, req, route, http.StatusTemporaryRedirect)
return
}
if req.URL.Path == "/" {