forked from hswaw/hscloud
hackdoc: when redirecting, skip ref if default
Change-Id: Ie1680500ede673c407c9c8f4bbbe6b7f6a41b422master
parent
34d39cc8ed
commit
81262ff202
|
@ -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…
Reference in New Issue