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:
commit
d774a7153b
2 changed files with 10 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 = ""
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue