fix(repo): prevent double-write redirect collisions on dependency errors, fix ui (#38627) (#38628)

Backport #38627

Co-authored-by: Sudhanshu Singh <sudhanshuwriterblc@gmail.com>
This commit is contained in:
wxiaoguangandSudhanshu Singh authored and GitHub committed 2026-07-25 08:48:56 -07:00
1 parent d141dc729c
commit a54324e2b7
2 files changed
+10 -1

No files matched your search

+6 -1
View File
@@ -35,7 +35,11 @@ func AddDependency(ctx *context.Context) {
}
// Redirect
defer ctx.Redirect(issue.Link())
defer func() {
if !ctx.Written() {
ctx.Redirect(issue.Link())
}
}()
// Dependency
dep, err := issues_model.GetIssueByID(ctx, depID)
@@ -152,6 +156,7 @@ func RemoveDependency(ctx *context.Context) {
if err = issues_model.RemoveIssueDependency(ctx, ctx.Doer, issue, dep, depType); err != nil {
if issues_model.IsErrDependencyNotExists(err) {
ctx.Flash.Error(ctx.Tr("repo.issues.dependency.add_error_dep_not_exist"))
ctx.Redirect(issue.Link())
return
}
ctx.ServerError("RemoveIssueDependency", err)