mirror of https://github.com/perkeep/perkeep.git
newui: redirect /ui/new to /ui/new/
Change-Id: I2686a3e577a32436d55e7cf5fd6640d1717caac5
This commit is contained in:
parent
e889394a74
commit
f696b164f4
|
@ -408,12 +408,18 @@ func (ui *UIHandler) serveFileTree(rw http.ResponseWriter, req *http.Request) {
|
|||
}
|
||||
|
||||
func (ui *UIHandler) serveNewUI(rw http.ResponseWriter, req *http.Request) {
|
||||
base := req.Header.Get("X-PrefixHandler-PathBase")
|
||||
suffix := req.Header.Get("X-PrefixHandler-PathSuffix")
|
||||
if ui.closureHandler == nil {
|
||||
log.Printf("%v not served: handler is nil", suffix)
|
||||
http.NotFound(rw, req)
|
||||
return
|
||||
}
|
||||
if suffix == "new" {
|
||||
// Add a trailing slash.
|
||||
http.Redirect(rw, req, base + "new/", http.StatusFound)
|
||||
return
|
||||
}
|
||||
suffix = path.Clean(suffix)
|
||||
|
||||
m := closurePattern.FindStringSubmatch(suffix)
|
||||
|
|
Loading…
Reference in New Issue