Add NotFound handler (#18062)
PR #17997 means that urls with terminal '/' are no longer immediately mapped to the url without a terminal slash. However, it has revealed that the NotFound handler appears to have been lost. This PR adds back in a NotFound handler that simply redirects to a path without the terminal slash or runs the NotFound handler. Fix #18060 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
a9ed1c5c7c
commit
62dcf1a6fb
3 changed files with 21 additions and 1 deletions
|
@ -61,6 +61,16 @@ func TestRedirectsNoLogin(t *testing.T) {
|
|||
resp := MakeRequest(t, req, http.StatusFound)
|
||||
assert.EqualValues(t, path.Join(setting.AppSubURL, redirectLink), test.RedirectURL(resp))
|
||||
}
|
||||
|
||||
var temporaryRedirects = map[string]string{
|
||||
"/user2/repo1/": "/user2/repo1",
|
||||
}
|
||||
for link, redirectLink := range temporaryRedirects {
|
||||
req := NewRequest(t, "GET", link)
|
||||
resp := MakeRequest(t, req, http.StatusTemporaryRedirect)
|
||||
assert.EqualValues(t, path.Join(setting.AppSubURL, redirectLink), test.RedirectURL(resp))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestNoLoginNotExist(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue