Skip to content

Commit ef47540

Browse files
authored
Merge branch 'main' into repogen-default-branch
2 parents 3601b26 + 909804b commit ef47540

File tree

94 files changed

+420
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+420
-252
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.16.5](https://github.com/go-gitea/gitea/releases/tag/v1.16.5) - 2022-03-23
8+
9+
* BREAKING
10+
* Bump to build with go1.18 (#19120 et al) (#19127)
11+
* SECURITY
12+
* Prevent redirect to Host (2) (#19175) (#19186)
13+
* Try to prevent autolinking of displaynames by email readers (#19169) (#19183)
14+
* Clean paths when looking in Storage (#19124) (#19179)
15+
* Do not send notification emails to inactive users (#19131) (#19139)
16+
* Do not send activation email if manual confirm is set (#19119) (#19122)
17+
* ENHANCEMENTS
18+
* Use the new/choose link for New Issue on project page (#19172) (#19176)
19+
* BUGFIXES
20+
* Fix showing issues in your repositories (#18916) (#19191)
21+
* Fix compare link in active feeds for new branch (#19149) (#19185)
22+
* Redirect .wiki/* ui link to /wiki (#18831) (#19184)
23+
* Ensure deploy keys with write access can push (#19010) (#19182)
24+
* Ensure that setting.LocalURL always has a trailing slash (#19171) (#19177)
25+
* Cleanup protected branches when deleting users & teams (#19158) (#19174)
26+
* Use IterateBufferSize whilst querying repositories during adoption check (#19140) (#19160)
27+
* Fix NPE /repos/issues/search when not signed in (#19154) (#19155)
28+
* Use custom favicon when viewing static files if it exists (#19130) (#19152)
29+
* Fix the editor height in review box (#19003) (#19147)
30+
* Ensure isSSH is set whenever DISABLE_HTTP_GIT is set (#19028) (#19146)
31+
* Fix wrong scopes caused by empty scope input (#19029) (#19145)
32+
* Make migrations SKIP_TLS_VERIFY apply to git too (#19132) (#19141)
33+
* Handle email address not exist (#19089) (#19121)
34+
* MISC
35+
* Update json-iterator to allow compilation with go1.18 (#18644) (#19100)
36+
* Update golang.org/x/crypto (#19097) (#19098)
37+
738
## [1.16.4](https://github.com/go-gitea/gitea/releases/tag/v1.16.4) - 2022-03-14
839

940
* SECURITY

cmd/web_acme.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,5 @@ func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) {
128128
// URI always contains a leading slash, which would result in a double
129129
// slash
130130
target := strings.TrimSuffix(setting.AppURL, "/") + r.URL.RequestURI()
131-
http.Redirect(w, r, target, http.StatusFound)
131+
http.Redirect(w, r, target, http.StatusTemporaryRedirect)
132132
}

docs/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.16.4
21+
version: 1.16.5
2222
minGoVersion: 1.17
2323
goVersion: 1.18
2424
minNodeVersion: 12.17

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ require (
8484
github.com/urfave/cli v1.22.5
8585
github.com/xanzy/go-gitlab v0.58.0
8686
github.com/yohcop/openid-go v1.0.0
87-
github.com/yuin/goldmark v1.4.8
87+
github.com/yuin/goldmark v1.4.11
8888
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594
8989
github.com/yuin/goldmark-meta v1.1.0
9090
go.jolheiser.com/hcaptcha v0.0.4

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,8 +1545,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
15451545
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
15461546
github.com/yuin/goldmark v1.4.5/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
15471547
github.com/yuin/goldmark v1.4.6/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
1548-
github.com/yuin/goldmark v1.4.8 h1:zHPiabbIRssZOI0MAzJDHsyvG4MXCGqVaMOwR+HeoQQ=
1549-
github.com/yuin/goldmark v1.4.8/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
1548+
github.com/yuin/goldmark v1.4.11 h1:i45YIzqLnUc2tGaTlJCyUxSG8TvgyGqhqOZOUKIjJ6w=
1549+
github.com/yuin/goldmark v1.4.11/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
15501550
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594 h1:yHfZyN55+5dp1wG7wDKv8HQ044moxkyGq12KFFMFDxg=
15511551
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594/go.mod h1:U9ihbh+1ZN7fR5Se3daSPoz1CGF9IYtSvWwVQtnzGHU=
15521552
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=

integrations/admin_user_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestAdminEditUser(t *testing.T) {
4646
}
4747

4848
func testSuccessfullEdit(t *testing.T, formData user_model.User) {
49-
makeRequest(t, formData, http.StatusFound)
49+
makeRequest(t, formData, http.StatusSeeOther)
5050
}
5151

5252
func makeRequest(t *testing.T, formData user_model.User, headerCode int) {

integrations/api_branch_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func testAPIGetBranchProtection(t *testing.T, branchName string, expectedHTTPSta
3737
req := NewRequestf(t, "GET", "/api/v1/repos/user2/repo1/branch_protections/%s?token=%s", branchName, token)
3838
resp := session.MakeRequest(t, req, expectedHTTPStatus)
3939

40-
if resp.Code == 200 {
40+
if resp.Code == http.StatusOK {
4141
var branchProtection api.BranchProtection
4242
DecodeJSON(t, resp, &branchProtection)
4343
assert.EqualValues(t, branchName, branchProtection.BranchName)
@@ -52,7 +52,7 @@ func testAPICreateBranchProtection(t *testing.T, branchName string, expectedHTTP
5252
})
5353
resp := session.MakeRequest(t, req, expectedHTTPStatus)
5454

55-
if resp.Code == 201 {
55+
if resp.Code == http.StatusCreated {
5656
var branchProtection api.BranchProtection
5757
DecodeJSON(t, resp, &branchProtection)
5858
assert.EqualValues(t, branchName, branchProtection.BranchName)
@@ -65,7 +65,7 @@ func testAPIEditBranchProtection(t *testing.T, branchName string, body *api.Bran
6565
req := NewRequestWithJSON(t, "PATCH", "/api/v1/repos/user2/repo1/branch_protections/"+branchName+"?token="+token, body)
6666
resp := session.MakeRequest(t, req, expectedHTTPStatus)
6767

68-
if resp.Code == 200 {
68+
if resp.Code == http.StatusOK {
6969
var branchProtection api.BranchProtection
7070
DecodeJSON(t, resp, &branchProtection)
7171
assert.EqualValues(t, branchName, branchProtection.BranchName)

integrations/api_helper_for_declarative_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func doAPICreatePullRequest(ctx APITestContext, owner, repo, baseBranch, headBra
227227
Title: fmt.Sprintf("create a pr from %s to %s", headBranch, baseBranch),
228228
})
229229

230-
expected := 201
230+
expected := http.StatusCreated
231231
if ctx.ExpectedCode != 0 {
232232
expected = ctx.ExpectedCode
233233
}
@@ -246,7 +246,7 @@ func doAPIGetPullRequest(ctx APITestContext, owner, repo string, index int64) fu
246246
owner, repo, index, ctx.Token)
247247
req := NewRequest(t, http.MethodGet, urlStr)
248248

249-
expected := 200
249+
expected := http.StatusOK
250250
if ctx.ExpectedCode != 0 {
251251
expected = ctx.ExpectedCode
252252
}
@@ -287,7 +287,7 @@ func doAPIMergePullRequest(ctx APITestContext, owner, repo string, index int64)
287287

288288
expected := ctx.ExpectedCode
289289
if expected == 0 {
290-
expected = 200
290+
expected = http.StatusOK
291291
}
292292

293293
if !assert.EqualValues(t, expected, resp.Code,
@@ -310,7 +310,7 @@ func doAPIManuallyMergePullRequest(ctx APITestContext, owner, repo, commitID str
310310
ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
311311
return
312312
}
313-
ctx.Session.MakeRequest(t, req, 200)
313+
ctx.Session.MakeRequest(t, req, http.StatusOK)
314314
}
315315
}
316316

integrations/api_pull_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestAPICreatePullSuccess(t *testing.T) {
7777
Base: "master",
7878
Title: "create a failure pr",
7979
})
80-
session.MakeRequest(t, req, 201)
80+
session.MakeRequest(t, req, http.StatusCreated)
8181
session.MakeRequest(t, req, http.StatusUnprocessableEntity) // second request should fail
8282
}
8383

@@ -105,7 +105,7 @@ func TestAPICreatePullWithFieldsSuccess(t *testing.T) {
105105

106106
req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls?token=%s", owner10.Name, repo10.Name, token), opts)
107107

108-
res := session.MakeRequest(t, req, 201)
108+
res := session.MakeRequest(t, req, http.StatusCreated)
109109
pull := new(api.PullRequest)
110110
DecodeJSON(t, res, pull)
111111

@@ -165,20 +165,20 @@ func TestAPIEditPull(t *testing.T) {
165165
Title: "create a success pr",
166166
})
167167
pull := new(api.PullRequest)
168-
resp := session.MakeRequest(t, req, 201)
168+
resp := session.MakeRequest(t, req, http.StatusCreated)
169169
DecodeJSON(t, resp, pull)
170170
assert.EqualValues(t, "master", pull.Base.Name)
171171

172172
req = NewRequestWithJSON(t, http.MethodPatch, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d?token=%s", owner10.Name, repo10.Name, pull.Index, token), &api.EditPullRequestOption{
173173
Base: "feature/1",
174174
Title: "edit a this pr",
175175
})
176-
resp = session.MakeRequest(t, req, 201)
176+
resp = session.MakeRequest(t, req, http.StatusCreated)
177177
DecodeJSON(t, resp, pull)
178178
assert.EqualValues(t, "feature/1", pull.Base.Name)
179179

180180
req = NewRequestWithJSON(t, http.MethodPatch, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d?token=%s", owner10.Name, repo10.Name, pull.Index, token), &api.EditPullRequestOption{
181181
Base: "not-exist",
182182
})
183-
session.MakeRequest(t, req, 404)
183+
session.MakeRequest(t, req, http.StatusNotFound)
184184
}

integrations/api_repo_languages_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestRepoLanguages(t *testing.T) {
3333
"content": "package main",
3434
"commit_choice": "direct",
3535
})
36-
session.MakeRequest(t, req, http.StatusFound)
36+
session.MakeRequest(t, req, http.StatusSeeOther)
3737

3838
// let gitea calculate language stats
3939
time.Sleep(time.Second)

integrations/attachment_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func createAttachment(t *testing.T, session *TestSession, repoURL, filename stri
5959
func TestCreateAnonymousAttachment(t *testing.T) {
6060
defer prepareTestEnv(t)()
6161
session := emptyTestSession(t)
62-
createAttachment(t, session, "user2/repo1", "image.png", generateImg(), http.StatusFound)
62+
createAttachment(t, session, "user2/repo1", "image.png", generateImg(), http.StatusSeeOther)
6363
}
6464

6565
func TestCreateIssueAttachment(t *testing.T) {
@@ -83,7 +83,7 @@ func TestCreateIssueAttachment(t *testing.T) {
8383
}
8484

8585
req = NewRequestWithValues(t, "POST", link, postData)
86-
resp = session.MakeRequest(t, req, http.StatusFound)
86+
resp = session.MakeRequest(t, req, http.StatusSeeOther)
8787
test.RedirectURL(resp) // check that redirect URL exists
8888

8989
// Validate that attachment is available

integrations/auth_ldap_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func addAuthSourceLDAP(t *testing.T, sshKeyAttribute string, groupMapParams ...s
135135
"group_team_map_removal": groupTeamMapRemoval,
136136
"user_uid": "DN",
137137
})
138-
session.MakeRequest(t, req, http.StatusFound)
138+
session.MakeRequest(t, req, http.StatusSeeOther)
139139
}
140140

141141
func TestLDAPUserSignin(t *testing.T) {
@@ -202,7 +202,7 @@ func TestLDAPAuthChange(t *testing.T) {
202202
"is_sync_enabled": "on",
203203
"is_active": "on",
204204
})
205-
session.MakeRequest(t, req, http.StatusFound)
205+
session.MakeRequest(t, req, http.StatusSeeOther)
206206

207207
req = NewRequest(t, "GET", href)
208208
resp = session.MakeRequest(t, req, http.StatusOK)

integrations/change_default_branch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestChangeDefaultBranch(t *testing.T) {
2828
"action": "default_branch",
2929
"branch": "DefaultBranch",
3030
})
31-
session.MakeRequest(t, req, http.StatusFound)
31+
session.MakeRequest(t, req, http.StatusSeeOther)
3232

3333
csrf = GetCSRF(t, session, branchesURL)
3434
req = NewRequestWithValues(t, "POST", branchesURL, map[string]string{

integrations/create_no_session_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func TestSessionFileCreation(t *testing.T) {
110110
"user_name": "user2",
111111
"password": userPassword,
112112
})
113-
resp = MakeRequest(t, req, http.StatusFound)
113+
resp = MakeRequest(t, req, http.StatusSeeOther)
114114
sessionID = getSessionID(t, resp)
115115

116116
assert.FileExists(t, sessionFile(tmpDir, sessionID))

integrations/delete_user_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestUserDeleteAccount(t *testing.T) {
3636
req := NewRequestWithValues(t, "POST", urlStr, map[string]string{
3737
"_csrf": csrf,
3838
})
39-
session.MakeRequest(t, req, http.StatusFound)
39+
session.MakeRequest(t, req, http.StatusSeeOther)
4040

4141
assertUserDeleted(t, 8)
4242
unittest.CheckConsistencyFor(t, &user_model.User{})
@@ -51,7 +51,7 @@ func TestUserDeleteAccountStillOwnRepos(t *testing.T) {
5151
req := NewRequestWithValues(t, "POST", urlStr, map[string]string{
5252
"_csrf": csrf,
5353
})
54-
session.MakeRequest(t, req, http.StatusFound)
54+
session.MakeRequest(t, req, http.StatusSeeOther)
5555

5656
// user should not have been deleted, because the user still owns repos
5757
unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})

integrations/editor_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestCreateFile(t *testing.T) {
3434
"content": "Content",
3535
"commit_choice": "direct",
3636
})
37-
session.MakeRequest(t, req, http.StatusFound)
37+
session.MakeRequest(t, req, http.StatusSeeOther)
3838
})
3939
}
4040

@@ -48,7 +48,7 @@ func TestCreateFileOnProtectedBranch(t *testing.T) {
4848
"_csrf": csrf,
4949
"protected": "on",
5050
})
51-
session.MakeRequest(t, req, http.StatusFound)
51+
session.MakeRequest(t, req, http.StatusSeeOther)
5252
// Check if master branch has been locked successfully
5353
flashCookie := session.GetCookie("macaron_flash")
5454
assert.NotNil(t, flashCookie)
@@ -82,7 +82,7 @@ func TestCreateFileOnProtectedBranch(t *testing.T) {
8282
"_csrf": csrf,
8383
"protected": "off",
8484
})
85-
resp = session.MakeRequest(t, req, http.StatusFound)
85+
resp = session.MakeRequest(t, req, http.StatusSeeOther)
8686
// Check if master branch has been locked successfully
8787
flashCookie = session.GetCookie("macaron_flash")
8888
assert.NotNil(t, flashCookie)
@@ -109,7 +109,7 @@ func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePa
109109
"commit_choice": "direct",
110110
},
111111
)
112-
resp = session.MakeRequest(t, req, http.StatusFound)
112+
resp = session.MakeRequest(t, req, http.StatusSeeOther)
113113

114114
// Verify the change
115115
req = NewRequest(t, "GET", path.Join(user, repo, "raw/branch", branch, filePath))
@@ -139,7 +139,7 @@ func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, bra
139139
"new_branch_name": targetBranch,
140140
},
141141
)
142-
resp = session.MakeRequest(t, req, http.StatusFound)
142+
resp = session.MakeRequest(t, req, http.StatusSeeOther)
143143

144144
// Verify the change
145145
req = NewRequest(t, "GET", path.Join(user, repo, "raw/branch", targetBranch, filePath))

integrations/git_smart_http_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,31 @@ func testGitSmartHTTP(t *testing.T, u *url.URL) {
2424
}{
2525
{
2626
p: "user2/repo1/info/refs",
27-
code: 200,
27+
code: http.StatusOK,
2828
},
2929
{
3030
p: "user2/repo1/HEAD",
31-
code: 200,
31+
code: http.StatusOK,
3232
},
3333
{
3434
p: "user2/repo1/objects/info/alternates",
35-
code: 404,
35+
code: http.StatusNotFound,
3636
},
3737
{
3838
p: "user2/repo1/objects/info/http-alternates",
39-
code: 404,
39+
code: http.StatusNotFound,
4040
},
4141
{
4242
p: "user2/repo1/../../custom/conf/app.ini",
43-
code: 404,
43+
code: http.StatusNotFound,
4444
},
4545
{
4646
p: "user2/repo1/objects/info/../../../../custom/conf/app.ini",
47-
code: 404,
47+
code: http.StatusNotFound,
4848
},
4949
{
5050
p: `user2/repo1/objects/info/..\..\..\..\custom\conf\app.ini`,
51-
code: 400,
51+
code: http.StatusBadRequest,
5252
},
5353
}
5454

integrations/git_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ func doProtectBranch(ctx APITestContext, branch, userToWhitelist, unprotectedFil
435435
"protected": "on",
436436
"unprotected_file_patterns": unprotectedFilePatterns,
437437
})
438-
ctx.Session.MakeRequest(t, req, http.StatusFound)
438+
ctx.Session.MakeRequest(t, req, http.StatusSeeOther)
439439
} else {
440440
user, err := user_model.GetUserByName(userToWhitelist)
441441
assert.NoError(t, err)
@@ -448,7 +448,7 @@ func doProtectBranch(ctx APITestContext, branch, userToWhitelist, unprotectedFil
448448
"whitelist_users": strconv.FormatInt(user.ID, 10),
449449
"unprotected_file_patterns": unprotectedFilePatterns,
450450
})
451-
ctx.Session.MakeRequest(t, req, http.StatusFound)
451+
ctx.Session.MakeRequest(t, req, http.StatusSeeOther)
452452
}
453453
// Check if master branch has been locked successfully
454454
flashCookie := ctx.Session.GetCookie("macaron_flash")

integrations/integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ func loginUserWithPassword(t testing.TB, userName, password string) *TestSession
380380
"user_name": userName,
381381
"password": password,
382382
})
383-
resp = MakeRequest(t, req, http.StatusFound)
383+
resp = MakeRequest(t, req, http.StatusSeeOther)
384384

385385
ch := http.Header{}
386386
ch.Add("Cookie", strings.Join(resp.Header()["Set-Cookie"], ";"))
@@ -408,7 +408,7 @@ func getTokenForLoggedInUser(t testing.TB, session *TestSession) string {
408408
"_csrf": doc.GetCSRF(),
409409
"name": fmt.Sprintf("api-testing-token-%d", tokenCounter),
410410
})
411-
resp = session.MakeRequest(t, req, http.StatusFound)
411+
resp = session.MakeRequest(t, req, http.StatusSeeOther)
412412
req = NewRequest(t, "GET", "/user/settings/applications")
413413
resp = session.MakeRequest(t, req, http.StatusOK)
414414
htmlDoc := NewHTMLParser(t, resp.Body)

0 commit comments

Comments
 (0)