4
0
Fork 2
mirror of https://gerrit.hackerspace.pl/hscloud synced 2025-03-25 18:14:52 +00:00

Merge "hackdoc: when redirecting, skip ref if default"

This commit is contained in:
q3k 2021-03-06 22:17:26 +00:00 committed by Gerrit Code Review
commit d774a7153b
2 changed files with 10 additions and 2 deletions

View file

@ -205,7 +205,15 @@ func (r *request) handlePageAuto(dirpath string) {
}
if file {
http.Redirect(r.w, r.r, "/"+fpath+"?ref="+r.ref, 302)
ref := r.ref
if ref == flagGitwebDefaultBranch {
ref = ""
}
path := "/" + fpath
if ref != "" {
path += "?ref=" + ref
}
http.Redirect(r.w, r.r, path, 302)
return
}
}

View file

@ -21,7 +21,7 @@ func renderMarkdown(input []byte, ref string) []byte {
// master is the default branch - do not make special links for that, as
// that makes them kinda ugly.
if ref == "master" {
if ref == flagGitwebDefaultBranch {
ref = ""
}