|
9 | 9 | "errors" |
10 | 10 | "fmt" |
11 | 11 | "net/http" |
12 | | - "net/url" |
13 | 12 | "strings" |
14 | 13 |
|
15 | 14 | "code.gitea.io/gitea/models" |
@@ -96,7 +95,7 @@ func checkAutoLogin(ctx *context.Context) bool { |
96 | 95 | if len(redirectTo) > 0 { |
97 | 96 | ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL, "", setting.SessionConfig.Secure, true) |
98 | 97 | } else { |
99 | | - redirectTo, _ = url.QueryUnescape(ctx.GetCookie("redirect_to")) |
| 98 | + redirectTo = ctx.GetCookie("redirect_to") |
100 | 99 | } |
101 | 100 |
|
102 | 101 | if isSucceed { |
@@ -496,7 +495,7 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR |
496 | 495 | return setting.AppSubURL + "/" |
497 | 496 | } |
498 | 497 |
|
499 | | - if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { |
| 498 | + if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { |
500 | 499 | ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) |
501 | 500 | if obeyRedirect { |
502 | 501 | ctx.RedirectToFirst(redirectTo) |
@@ -587,7 +586,7 @@ func handleOAuth2SignIn(u *models.User, gothUser goth.User, ctx *context.Context |
587 | 586 | return |
588 | 587 | } |
589 | 588 |
|
590 | | - if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 { |
| 589 | + if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 { |
591 | 590 | ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) |
592 | 591 | ctx.RedirectToFirst(redirectTo) |
593 | 592 | return |
@@ -1298,7 +1297,7 @@ func MustChangePasswordPost(ctx *context.Context, cpt *captcha.Captcha, form aut |
1298 | 1297 |
|
1299 | 1298 | log.Trace("User updated password: %s", u.Name) |
1300 | 1299 |
|
1301 | | - if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { |
| 1300 | + if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { |
1302 | 1301 | ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL) |
1303 | 1302 | ctx.RedirectToFirst(redirectTo) |
1304 | 1303 | return |
|
0 commit comments