From f696b164f44bfdcd2f33b984eddc226b9c3866ef Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 20 Jan 2013 12:33:15 -0800 Subject: [PATCH] newui: redirect /ui/new to /ui/new/ Change-Id: I2686a3e577a32436d55e7cf5fd6640d1717caac5 --- pkg/server/ui.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/server/ui.go b/pkg/server/ui.go index 18e4eb43d..e90d74089 100644 --- a/pkg/server/ui.go +++ b/pkg/server/ui.go @@ -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)