diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-03-13 14:57:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 06:57:30 +0000 |
commit | 67e9f0d49828f62a942ac6db04153207f88e82ee (patch) | |
tree | a2d7871a69039d3a32467d914933c695df87828e /tests/integration/user_test.go | |
parent | 9a93b1816e0bc65101e7ad7ca66786fb38a8e628 (diff) | |
download | gitea-67e9f0d49828f62a942ac6db04153207f88e82ee.tar.gz gitea-67e9f0d49828f62a942ac6db04153207f88e82ee.zip |
Fix user router possbile panic (#29751)
regression from #28023
Diffstat (limited to 'tests/integration/user_test.go')
-rw-r--r-- | tests/integration/user_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/integration/user_test.go b/tests/integration/user_test.go index c30733b1b0..c4544f37aa 100644 --- a/tests/integration/user_test.go +++ b/tests/integration/user_test.go @@ -243,6 +243,8 @@ func testExportUserGPGKeys(t *testing.T, user, expected string) { } func TestGetUserRss(t *testing.T) { + defer tests.PrepareTestEnv(t)() + user34 := "the_34-user.with.all.allowedChars" req := NewRequestf(t, "GET", "/%s.rss", user34) resp := MakeRequest(t, req, http.StatusOK) @@ -253,6 +255,13 @@ func TestGetUserRss(t *testing.T) { description, _ := rssDoc.ChildrenFiltered("description").Html() assert.EqualValues(t, "<p dir="auto">some <a href="https://commonmark.org/" rel="nofollow">commonmark</a>!</p>\n", description) } + + req = NewRequestf(t, "GET", "/non-existent-user.rss") + MakeRequest(t, req, http.StatusNotFound) + + session := loginUser(t, "user2") + req = NewRequestf(t, "GET", "/non-existent-user.rss") + session.MakeRequest(t, req, http.StatusNotFound) } func TestListStopWatches(t *testing.T) { |