use simpler path for raw routes to avoid conflicts with repos with branch called 'raw'

This commit is contained in:
Iris Lightshard 2023-02-05 12:05:15 -07:00
parent e6a2ef8560
commit ad6ece2ad2
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 2 additions and 2 deletions

View file

@ -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")

View file

@ -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 {