From ad6ece2ad2983cfdec5fea36706f8813952b1f47 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Sun, 5 Feb 2023 12:05:15 -0700 Subject: [PATCH] use simpler path for raw routes to avoid conflicts with repos with branch called 'raw' --- routes/handler.go | 2 +- routes/util.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/handler.go b/routes/handler.go index a5a8620..bbb630d 100644 --- a/routes/handler.go +++ b/routes/handler.go @@ -42,7 +42,7 @@ func Handlers(c *config.Config, t *template.Template) *flow.Mux { mux.HandleFunc("/static/:file", d.ServeStatic, "GET") mux.HandleFunc("/:name", d.Multiplex, "GET", "POST") mux.HandleFunc("/:name/tree/:ref/...", d.RepoTree, "GET") - mux.HandleFunc("/:name/blob/raw/:ref/...", d.ServeStaticInRepo, "GET") + mux.HandleFunc("/:name/raw/:ref/...", d.ServeStaticInRepo, "GET") mux.HandleFunc("/:name/blob/:ref/...", d.FileContent, "GET") mux.HandleFunc("/:name/log/:ref", d.Log, "GET") mux.HandleFunc("/:name/commit/:ref", d.Diff, "GET") diff --git a/routes/util.go b/routes/util.go index 3536946..74161f8 100644 --- a/routes/util.go +++ b/routes/util.go @@ -28,7 +28,7 @@ func transformRelativeURLs(html, repoName, mainBranch string) string { return strings.ReplaceAll( html, "=\"./", - fmt.Sprintf("=\"/%s/blob/raw/%s/", repoName, mainBranch)) + fmt.Sprintf("=\"/%s/raw/%s/", repoName, mainBranch)) } func (d *deps) isIgnored(name string) bool {