]> source.dussan.org Git - gitea.git/commitdiff
Fix `link-action` redirect network error (#27734)
authorNanguan Lin <70063547+lng2020@users.noreply.github.com>
Mon, 23 Oct 2023 12:34:17 +0000 (20:34 +0800)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2023 12:34:17 +0000 (20:34 +0800)
<img width="823" alt="image"
src="https://github.com/go-gitea/gitea/assets/70063547/99da3d5a-c28a-4fd0-8ae0-88461a9142e2">

---------

Co-authored-by: 6543 <6543@obermui.de>
routers/web/repo/milestone.go
routers/web/repo/projects.go

index 4db02fce9ea4ffd99fa20010aeb6149b4d71a4ed..0e6f63074749f8e477fad833fb11d5fc0f4bd8e6 100644 (file)
@@ -231,14 +231,15 @@ func EditMilestonePost(ctx *context.Context) {
 
 // ChangeMilestoneStatus response for change a milestone's status
 func ChangeMilestoneStatus(ctx *context.Context) {
-       toClose := false
+       var toClose bool
        switch ctx.Params(":action") {
        case "open":
                toClose = false
        case "close":
                toClose = true
        default:
-               ctx.Redirect(ctx.Repo.RepoLink + "/milestones")
+               ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones")
+               return
        }
        id := ctx.ParamsInt64(":id")
 
@@ -250,7 +251,7 @@ func ChangeMilestoneStatus(ctx *context.Context) {
                }
                return
        }
-       ctx.Redirect(ctx.Repo.RepoLink + "/milestones?state=" + url.QueryEscape(ctx.Params(":action")))
+       ctx.JSONRedirect(ctx.Repo.RepoLink + "/milestones?state=" + url.QueryEscape(ctx.Params(":action")))
 }
 
 // DeleteMilestone delete a milestone
index ada398fdc8e9ce93393f99546c7cad5476ac31a0..6417024f8ba3c638049861451bba55b6619c1b2e 100644 (file)
@@ -161,14 +161,15 @@ func NewProjectPost(ctx *context.Context) {
 
 // ChangeProjectStatus updates the status of a project between "open" and "close"
 func ChangeProjectStatus(ctx *context.Context) {
-       toClose := false
+       var toClose bool
        switch ctx.Params(":action") {
        case "open":
                toClose = false
        case "close":
                toClose = true
        default:
-               ctx.Redirect(ctx.Repo.RepoLink + "/projects")
+               ctx.JSONRedirect(ctx.Repo.RepoLink + "/projects")
+               return
        }
        id := ctx.ParamsInt64(":id")
 
@@ -180,7 +181,7 @@ func ChangeProjectStatus(ctx *context.Context) {
                }
                return
        }
-       ctx.Redirect(ctx.Repo.RepoLink + "/projects?state=" + url.QueryEscape(ctx.Params(":action")))
+       ctx.JSONRedirect(ctx.Repo.RepoLink + "/projects?state=" + url.QueryEscape(ctx.Params(":action")))
 }
 
 // DeleteProject delete a project