forked from tangled.org/core
this repo has no description

appview/state: redirect repo.git to repo

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>

anirudh.fi ce03b9db cde279f0

verified
Changed files
+6 -1
appview
state
+6 -1
appview/state/router.go
···
r.Get("/", s.Profile)
r.Get("/feed.atom", s.AtomFeedPage)
+
// redirect /@handle/repo.git -> /@handle/repo
+
r.Get("/{repo}.git", func(w http.ResponseWriter, r *http.Request) {
+
nonDotGitPath := strings.TrimSuffix(r.URL.Path, ".git")
+
http.Redirect(w, r, nonDotGitPath, http.StatusMovedPermanently)
+
})
+
r.With(mw.ResolveRepo()).Route("/{repo}", func(r chi.Router) {
r.Use(mw.GoImport())
-
r.Mount("/", s.RepoRouter(mw))
r.Mount("/issues", s.IssuesRouter(mw))
r.Mount("/pulls", s.PullsRouter(mw))