Skip to content

Commit 12d8af8

Browse files
committed
limit var scope if posible
1 parent 4c65af1 commit 12d8af8

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

routers/web/repo/issue.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,14 +1722,12 @@ func UpdateIssueContent(ctx *context.Context) {
17221722
return
17231723
}
17241724

1725-
content := ctx.FormString("content")
1726-
if err := issue_service.ChangeContent(issue, ctx.User, content); err != nil {
1725+
if err := issue_service.ChangeContent(issue, ctx.User, ctx.Req.FormValue("content")); err != nil {
17271726
ctx.ServerError("ChangeContent", err)
17281727
return
17291728
}
17301729

1731-
files := ctx.FormStrings("files[]")
1732-
if err := updateAttachments(issue, files); err != nil {
1730+
if err := updateAttachments(issue, ctx.FormStrings("files[]")); err != nil {
17331731
ctx.ServerError("UpdateAttachments", err)
17341732
return
17351733
}
@@ -2157,8 +2155,7 @@ func UpdateCommentContent(ctx *context.Context) {
21572155
return
21582156
}
21592157

2160-
files := ctx.FormStrings("files[]")
2161-
if err := updateAttachments(comment, files); err != nil {
2158+
if err := updateAttachments(comment, ctx.FormStrings("files[]")); err != nil {
21622159
ctx.ServerError("UpdateAttachments", err)
21632160
return
21642161
}

routers/web/user/auth.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,8 +1491,7 @@ func ForgotPasswd(ctx *context.Context) {
14911491
return
14921492
}
14931493

1494-
email := ctx.FormString("email")
1495-
ctx.Data["Email"] = email
1494+
ctx.Data["Email"] = ctx.FormString("email")
14961495

14971496
ctx.Data["IsResetRequest"] = true
14981497
ctx.HTML(http.StatusOK, tplForgotPassword)

0 commit comments

Comments
 (0)